Skip to content

Commit

Permalink
Disable config-only search for Boost (dyninst#1804)
Browse files Browse the repository at this point in the history
Using the `HINTS` syntax for `find_package` forces a config-only search
for Boost (i.e. BoostConfig.cmake). Some notable distros, specifically
RHEL 9.x, have a new enough Boost but do not include BoostConfig.cmake
which breaks the build. Removing this syntax instead uses the
FindBoost.cmake shipped with CMake which works in more scenarios and for
older versions of Boost.

Signed-off-by: Jonathon Anderson <[email protected]>
  • Loading branch information
blue42u authored Nov 2, 2024
1 parent 77c6fd6 commit fb3666e
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions cmake/tpls/DyninstBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@

include_guard(GLOBAL)

# Need at least 1.71 for a usable BoostConfig.cmake
set(_min_version 1.71.0)

# Silence a warning about CMake 3.30 removing the FindBoost module
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()

# Use multithreaded libraries
set(Boost_USE_MULTITHREADED ON)

# Don't use libraries linked statically to the C++ runtime
set(Boost_USE_STATIC_RUNTIME OFF)

# Follow convention with custom Find modules
if(Boost_ROOT_DIR)
set(Boost_NO_SYSTEM_PATHS ON)
set(Boost_ROOT ${Boost_ROOT_DIR})
Expand All @@ -36,15 +41,7 @@ set(Boost_NO_WARN_NEW_VERSIONS ON)

# Library components that need to be linked against
set(_boost_components atomic chrono date_time filesystem thread timer)
find_package(
Boost
${_min_version}
QUIET
REQUIRED
HINTS
${PATH_BOOST}
${BOOST_ROOT}
COMPONENTS ${_boost_components})
find_package(Boost ${_min_version} QUIET REQUIRED COMPONENTS ${_boost_components})

# Don't let Boost variables seep through
mark_as_advanced(Boost_DIR)
Expand Down

0 comments on commit fb3666e

Please sign in to comment.