diff --git a/cmake/HPX_SetupBoost.cmake b/cmake/HPX_SetupBoost.cmake index 43360e5571d..40eca7ec774 100644 --- a/cmake/HPX_SetupBoost.cmake +++ b/cmake/HPX_SetupBoost.cmake @@ -68,6 +68,10 @@ if(HPX_WITH_FETCH_BOOST) "${CMAKE_BINARY_DIR}/_deps/boost-src" CACHE INTERNAL "" ) + + set(HPX_FIND_BOOST_PACKAGE_MODE MODULE) +else() + set(HPX_FIND_BOOST_PACKAGE_MODE CONFIG) endif() # In case find_package(HPX) is called multiple times @@ -82,6 +86,7 @@ if(NOT TARGET hpx_dependencies_boost) # cmake-format: off set(Boost_ADDITIONAL_VERSIONS ${Boost_ADDITIONAL_VERSIONS} + "1.86.0" "1.86" "1.85.0" "1.85" "1.84.0" "1.84" "1.83.0" "1.83" @@ -109,7 +114,10 @@ if(NOT TARGET hpx_dependencies_boost) hpx_set_cmake_policy(CMP0167 OLD) # use CMake's FindBoost for now # Find the headers and get the version - find_package(Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE MODULE REQUIRED) + find_package( + Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE + ${HPX_FIND_BOOST_PACKAGE_MODE} REQUIRED + ) if(NOT Boost_VERSION_STRING) set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" @@ -142,8 +150,8 @@ if(NOT TARGET hpx_dependencies_boost) endif() find_package( - Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE MODULE REQUIRED - COMPONENTS ${__boost_libraries} + Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE + ${HPX_FIND_BOOST_PACKAGE_MODE} REQUIRED COMPONENTS ${__boost_libraries} ) if(NOT Boost_FOUND) diff --git a/cmake/HPX_SetupBoostFilesystem.cmake b/cmake/HPX_SetupBoostFilesystem.cmake index 65b69a14392..b4b5f518a97 100644 --- a/cmake/HPX_SetupBoostFilesystem.cmake +++ b/cmake/HPX_SetupBoostFilesystem.cmake @@ -10,8 +10,8 @@ if(HPX_FILESYSTEM_WITH_BOOST_FILESYSTEM_COMPATIBILITY) hpx_set_cmake_policy(CMP0167 OLD) # use CMake's FindBoost for now find_package( - Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE MODULE - COMPONENTS filesystem + Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE + ${HPX_FIND_BOOST_PACKAGE_MODE} COMPONENTS filesystem ) if(NOT Boost_FILESYSTEM_FOUND) diff --git a/cmake/HPX_SetupBoostIostreams.cmake b/cmake/HPX_SetupBoostIostreams.cmake index 92c68bf44f7..af97bd6995b 100644 --- a/cmake/HPX_SetupBoostIostreams.cmake +++ b/cmake/HPX_SetupBoostIostreams.cmake @@ -12,7 +12,8 @@ if((HPX_WITH_COMPRESSION_BZIP2 hpx_set_cmake_policy(CMP0167 OLD) # use CMake's FindBoost for now find_package( - Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE MODULE COMPONENTS iostreams + Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE + ${HPX_FIND_BOOST_PACKAGE_MODE} COMPONENTS iostreams ) if(Boost_IOSTREAMS_FOUND) diff --git a/cmake/HPX_SetupBoostRegex.cmake b/cmake/HPX_SetupBoostRegex.cmake index c3ab0448dbd..82cdc062c5d 100644 --- a/cmake/HPX_SetupBoostRegex.cmake +++ b/cmake/HPX_SetupBoostRegex.cmake @@ -8,7 +8,8 @@ if(NOT TARGET Boost::regex) hpx_set_cmake_policy(CMP0167 OLD) # use CMake's FindBoost for now find_package( - Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE MODULE COMPONENTS regex + Boost ${Boost_MINIMUM_VERSION} NO_POLICY_SCOPE + ${HPX_FIND_BOOST_PACKAGE_MODE} COMPONENTS regex ) if(Boost_REGEX_FOUND)