瀏覽代碼

cmake: Only config Boost during find_package

Without the CONFIG option, find_package will perform Module search. On
at least Linux Mint 20 (I'm unable to reproduce this on CentOS and Arch
Linux), my guess is that this causes CMake to find "dirty" modules that
modify the configuration state despite the Boost version being too
low/absent.

Use CONFIG to put CMake into pure Config mode and avoid Module search.
lat9nq 5 年之前
父節點
當前提交
697a2c0018
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      CMakeLists.txt

+ 2 - 2
CMakeLists.txt

@@ -202,7 +202,7 @@ macro(yuzu_find_packages)
 endmacro()
 
 if (NOT YUZU_USE_BUNDLED_BOOST)
-    find_package(Boost 1.73.0 COMPONENTS context headers QUIET)
+    find_package(Boost 1.73.0 CONFIG COMPONENTS context headers QUIET)
 endif()
 if (Boost_FOUND)
     set(Boost_LIBRARIES Boost::boost)
@@ -224,7 +224,7 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR YUZU_USE_BUNDLED_BOOST)
     download_bundled_external("boost/" ${Boost_EXT_NAME} "")
     set(Boost_USE_DEBUG_RUNTIME FALSE)
     set(Boost_USE_STATIC_LIBS ON)
-    find_package(Boost 1.75.0 REQUIRED COMPONENTS context headers PATHS ${Boost_PATH} NO_DEFAULT_PATH)
+    find_package(Boost 1.75.0 CONFIG REQUIRED COMPONENTS context headers PATHS ${Boost_PATH} NO_DEFAULT_PATH)
     # Manually set the include dirs since the find_package sets it incorrectly
     set(Boost_INCLUDE_DIRS ${Boost_PATH}/include CACHE PATH "Path to Boost headers" FORCE)
     include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")