diff options
| author | 2020-12-14 18:06:24 -0500 | |
|---|---|---|
| committer | 2020-12-15 23:47:29 -0500 | |
| commit | 9b023a56a3dd42c96a95e1d56698d68e286d9abd (patch) | |
| tree | 916ed568f5d7bbb1a14f4533fa790ef378243673 | |
| parent | Merge pull request #5193 from lat9nq/fix-conan-boost (diff) | |
| download | yuzu-9b023a56a3dd42c96a95e1d56698d68e286d9abd.tar.gz yuzu-9b023a56a3dd42c96a95e1d56698d68e286d9abd.tar.xz yuzu-9b023a56a3dd42c96a95e1d56698d68e286d9abd.zip | |
cmake/conan: Conditionally add target Boost::context
Addresses an issue with the two competing versions of Conan's Boost
package that are currently floating around.
Adds the Boost::context target only if it's recognized by CMake as a
target.
| -rw-r--r-- | CMakeLists.txt | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2366d372c..66bbd985a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -194,13 +194,18 @@ macro(yuzu_find_packages) | |||
| 194 | unset(FN_FORCE_REQUIRED) | 194 | unset(FN_FORCE_REQUIRED) |
| 195 | endmacro() | 195 | endmacro() |
| 196 | 196 | ||
| 197 | if (NOT Boost_FOUND) | 197 | find_package(Boost 1.73.0 COMPONENTS context headers QUIET) |
| 198 | find_package(Boost 1.73.0 COMPONENTS context headers QUIET) | 198 | if (Boost_FOUND) |
| 199 | if (Boost_FOUND) | 199 | set(Boost_LIBRARIES Boost::boost) |
| 200 | set(Boost_LIBRARIES Boost::boost Boost::context) | 200 | # Conditionally add Boost::context only if the active version of the Conan or system Boost package provides it |
| 201 | # The old version is missing Boost::context, so we want to avoid adding in that case | ||
| 202 | # The new version requires adding Boost::context to prevent linking issues | ||
| 203 | # | ||
| 204 | # This one is used by Conan on subsequent CMake configures, not the first configure. | ||
| 205 | if (TARGET Boost::context) | ||
| 206 | list(APPEND Boost_LIBRARIES Boost::context) | ||
| 201 | endif() | 207 | endif() |
| 202 | endif() | 208 | else() |
| 203 | if (NOT Boost_FOUND) | ||
| 204 | message(STATUS "Boost 1.73.0 or newer not found, falling back to Conan") | 209 | message(STATUS "Boost 1.73.0 or newer not found, falling back to Conan") |
| 205 | list(APPEND CONAN_REQUIRED_LIBS "boost/1.73.0") | 210 | list(APPEND CONAN_REQUIRED_LIBS "boost/1.73.0") |
| 206 | endif() | 211 | endif() |
| @@ -312,6 +317,12 @@ if (CONAN_REQUIRED_LIBS) | |||
| 312 | if (NOT Boost_FOUND) | 317 | if (NOT Boost_FOUND) |
| 313 | find_package(Boost 1.73.0 REQUIRED COMPONENTS context headers) | 318 | find_package(Boost 1.73.0 REQUIRED COMPONENTS context headers) |
| 314 | set(Boost_LIBRARIES Boost::boost) | 319 | set(Boost_LIBRARIES Boost::boost) |
| 320 | # Conditionally add Boost::context only if the active version of the Conan Boost package provides it | ||
| 321 | # The old version is missing Boost::context, so we want to avoid adding in that case | ||
| 322 | # The new version requires adding Boost::context to prevent linking issues | ||
| 323 | if (TARGET Boost::context) | ||
| 324 | list(APPEND Boost_LIBRARIES Boost::context) | ||
| 325 | endif() | ||
| 315 | endif() | 326 | endif() |
| 316 | 327 | ||
| 317 | # Due to issues with variable scopes in functions, we need to also find_package(qt5) outside of the function | 328 | # Due to issues with variable scopes in functions, we need to also find_package(qt5) outside of the function |