From f86b00c02e2d30e2a422df22eb0a3f1995c5fc37 Mon Sep 17 00:00:00 2001 From: Pansysk75 Date: Wed, 11 Sep 2024 15:02:44 -0500 Subject: [PATCH] Use find_package to locate HPX-installed Boost --- cmake/HPX_SetupBoost.cmake | 42 ------------------------------ cmake/templates/HPXConfig.cmake.in | 31 ++++++++++++++-------- cmake/templates/HPXMacros.cmake.in | 2 +- 3 files changed, 21 insertions(+), 54 deletions(-) diff --git a/cmake/HPX_SetupBoost.cmake b/cmake/HPX_SetupBoost.cmake index 05f5cfcd5614..9e8c74ec449f 100644 --- a/cmake/HPX_SetupBoost.cmake +++ b/cmake/HPX_SetupBoost.cmake @@ -15,49 +15,7 @@ if(NOT TARGET hpx_dependencies_boost) set(Boost_USE_STATIC_LIBS ON) endif() -<<<<<<< HEAD - # Add additional version to recognize - # cmake-format: off - set(Boost_ADDITIONAL_VERSIONS - ${Boost_ADDITIONAL_VERSIONS} - "1.85.0" "1.85" - "1.84.0" "1.84" - "1.83.0" "1.83" - "1.82.0" "1.82" - "1.81.0" "1.81" - "1.80.0" "1.80" - "1.79.0" "1.79" - "1.78.0" "1.78" - "1.77.0" "1.77" - "1.76.0" "1.76" - "1.75.0" "1.75" - "1.74.0" "1.74" - "1.73.0" "1.73" - "1.72.0" "1.72" - "1.71.0" "1.71" - ) - # cmake-format: on - set(Boost_MINIMUM_VERSION - "1.71" - CACHE INTERNAL "1.71" FORCE - ) - - set(Boost_NO_BOOST_CMAKE ON) # disable the search for boost-cmake - - 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) - if(NOT Boost_VERSION_STRING) - set(Boost_VERSION_STRING - "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" - ) - endif() - - set(__boost_libraries "") -======= # set(__boost_libraries disable_autolinking) ->>>>>>> 8d8b4e6456 (Fetch Boost as a CMake subproject) if(HPX_PARCELPORT_LIBFABRIC_WITH_LOGGING OR HPX_PARCELPORT_LIBFABRIC_WITH_DEV_MODE ) diff --git a/cmake/templates/HPXConfig.cmake.in b/cmake/templates/HPXConfig.cmake.in index 3c5161690bde..ba64cfb6c96d 100644 --- a/cmake/templates/HPXConfig.cmake.in +++ b/cmake/templates/HPXConfig.cmake.in @@ -91,6 +91,26 @@ if("${HPX_WITH_DATAPAR_BACKEND}" STREQUAL "SVE") endif() endif() +if(HPX_WITH_FETCH_BOOST) + # Boost has been installed alongside HPX + # Let HPX_SetupBoost find it + set(HPX_BOOST_ROOT "${CMAKE_CURRENT_LIST_DIR}/../") + include(HPX_SetupBoost) + include(HPX_SetupBoostFilesystem) + include(HPX_SetupBoostIostreams) +else() + # Boost Separate boost targets to be unarily linked to some modules + set(HPX_BOOST_ROOT "@Boost_ROOT@") + # By default Boost_ROOT is set to HPX_BOOST_ROOT (not necessary for PAPI or + # HWLOC cause we are specifying HPX__ROOT as an HINT to find_package) + if(NOT Boost_ROOT AND NOT "$ENV{BOOST_ROOT}") + set(Boost_ROOT ${HPX_BOOST_ROOT}) + endif() + include(HPX_SetupBoost) + include(HPX_SetupBoostFilesystem) + include(HPX_SetupBoostIostreams) +endif() + include("${CMAKE_CURRENT_LIST_DIR}/HPXInternalTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/HPXTargets.cmake") @@ -156,17 +176,6 @@ include(HPX_SetupAllocator) include(HPX_SetupThreads) -# Boost Separate boost targets to be unarily linked to some modules -set(HPX_BOOST_ROOT "@Boost_ROOT@") -# By default Boost_ROOT is set to HPX_BOOST_ROOT (not necessary for PAPI or -# HWLOC cause we are specifying HPX__ROOT as an HINT to find_package) -if(NOT Boost_ROOT AND NOT "$ENV{BOOST_ROOT}") - set(Boost_ROOT ${HPX_BOOST_ROOT}) -endif() -include(HPX_SetupBoost) -include(HPX_SetupBoostFilesystem) -include(HPX_SetupBoostIostreams) - # HIP include(HPX_SetupHIP) diff --git a/cmake/templates/HPXMacros.cmake.in b/cmake/templates/HPXMacros.cmake.in index a3dd7a5f8e13..518aced7c4f9 100644 --- a/cmake/templates/HPXMacros.cmake.in +++ b/cmake/templates/HPXMacros.cmake.in @@ -88,7 +88,7 @@ function(hpx_check_compiler_compatibility) endfunction() function(hpx_check_boost_compatibility) - if(HPX_IGNORE_BOOST_COMPATIBILITY) + if(HPX_IGNORE_BOOST_COMPATIBILITY OR HPX_WITH_FETCH_BOOST) return() endif() if(NOT DEFINED Boost_ROOT)