From 57fd8b1f451f95495167581066e3fcf981f7c054 Mon Sep 17 00:00:00 2001 From: Alexandre Bouvier Date: Tue, 6 Dec 2022 21:01:26 +0100 Subject: cmake: use correct boost imported targets --- CMakeLists.txt | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f344ffd9..5f6f86e68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,6 +210,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) # ======================================================================= # Enforce the search mode of non-required packages for better and shorter failure messages +find_package(Boost 1.73.0 REQUIRED context) find_package(enet 1.3 MODULE) find_package(fmt 9 REQUIRED) find_package(inih MODULE) @@ -253,19 +254,6 @@ if (YUZU_TESTS) find_package(Catch2 3.0.1 REQUIRED) endif() -find_package(Boost 1.73.0 COMPONENTS context) -if (Boost_FOUND) - set(Boost_LIBRARIES Boost::boost) - # Conditionally add Boost::context only if the found Boost package provides it - # The old version is missing Boost::context, so we want to avoid adding in that case - # The new version requires adding Boost::context to prevent linking issues - if (TARGET Boost::context) - list(APPEND Boost_LIBRARIES Boost::context) - endif() -else() - message(FATAL_ERROR "Boost 1.73.0 or newer not found") -endif() - # boost:asio has functions that require AcceptEx et al if (MINGW) find_library(MSWSOCK_LIBRARY mswsock REQUIRED) @@ -462,14 +450,6 @@ if (ENABLE_SDL2) endif() endif() -# Reexport some targets that are named differently when using the upstream CmakeConfig -# In order to ALIAS targets to a new name, they first need to be IMPORTED_GLOBAL -# Dynarmic checks for target `boost` and so we want to make sure it can find it through our system instead of using their external -if (TARGET Boost::boost) - set_target_properties(Boost::boost PROPERTIES IMPORTED_GLOBAL TRUE) - add_library(boost ALIAS Boost::boost) -endif() - # List of all FFmpeg components required set(FFmpeg_COMPONENTS avcodec @@ -585,11 +565,7 @@ function(create_target_directory_groups target_name) endfunction() # Prevent boost from linking against libs when building -add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY - -DBOOST_SYSTEM_NO_LIB - -DBOOST_DATE_TIME_NO_LIB - -DBOOST_REGEX_NO_LIB -) +target_link_libraries(Boost::headers INTERFACE Boost::disable_autolinking) # Adjustments for MSVC + Ninja if (MSVC AND CMAKE_GENERATOR STREQUAL "Ninja") add_compile_options( -- cgit v1.2.3