Skip to content

Commit

Permalink
Use find_package to locate HPX-installed Boost
Browse files Browse the repository at this point in the history
  • Loading branch information
Pansysk75 committed Sep 11, 2024
1 parent 6d436e0 commit f86b00c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 54 deletions.
42 changes: 0 additions & 42 deletions cmake/HPX_SetupBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
31 changes: 20 additions & 11 deletions cmake/templates/HPXConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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_<lib>_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")

Expand Down Expand Up @@ -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_<lib>_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)

Expand Down
2 changes: 1 addition & 1 deletion cmake/templates/HPXMacros.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f86b00c

Please sign in to comment.