From fb3666eff57951967e0176603e71dd8efdd1a508 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson <17242663+blue42u@users.noreply.github.com> Date: Sat, 2 Nov 2024 15:42:51 -0500 Subject: [PATCH] Disable config-only search for Boost (#1804) 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 --- cmake/tpls/DyninstBoost.cmake | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/cmake/tpls/DyninstBoost.cmake b/cmake/tpls/DyninstBoost.cmake index ddf3829d8e..5403688919 100644 --- a/cmake/tpls/DyninstBoost.cmake +++ b/cmake/tpls/DyninstBoost.cmake @@ -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}) @@ -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)