From 7d0015777388f7cff23ad13c8d5257f600ae0177 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 13 Nov 2025 18:17:32 +0200 Subject: [PATCH] Update the CMakeLists.txt files for System and Regex, because they are header-only in 1.89 and above and no longer have components --- test/regex/CMakeLists.txt | 27 +++++++-------------------- test/system/CMakeLists.txt | 14 +++++++------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/test/regex/CMakeLists.txt b/test/regex/CMakeLists.txt index 890b710..27d4ada 100644 --- a/test/regex/CMakeLists.txt +++ b/test/regex/CMakeLists.txt @@ -18,32 +18,19 @@ if(USE_STAGED_BOOST) set(BOOST_HINTS HINTS ../../../../stage) endif() -if(USE_BOOST_PACKAGE) +# Regex is header-only in b2 starting from 1.89, so there's no `regex` component anymore - find_package(Boost ${BOOST_VERSION} EXACT REQUIRED COMPONENTS regex ${BOOST_HINTS}) +find_package(Boost ${BOOST_VERSION} EXACT REQUIRED OPTIONAL_COMPONENTS regex ${BOOST_HINTS}) - # Using `include_directories`, `link_directories`, `link_libraries` - # is bad practice, done here for testing purposes. The right, "modern - # CMake", thing to do is `target_link_libraries(main Boost::regex)`. +# Using `include_directories`, `link_directories`, `link_libraries` +# is bad practice, only done here for testing purposes. - include_directories(${Boost_INCLUDE_DIRS}) - link_directories(${Boost_LIBRARY_DIRS}) - link_libraries(${Boost_LIBRARIES}) - -else() - - find_package(boost_regex ${BOOST_VERSION} EXACT CONFIG REQUIRED ${BOOST_HINTS}) - -endif() +include_directories(${Boost_INCLUDE_DIRS}) +link_directories(${Boost_LIBRARY_DIRS}) +link_libraries(${Boost_LIBRARIES}) add_executable(main quick.cpp) -if(NOT USE_BOOST_PACKAGE) - - target_link_libraries(main Boost::regex) - -endif() - enable_testing() add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --no-tests=error -C $) diff --git a/test/system/CMakeLists.txt b/test/system/CMakeLists.txt index 6cbd821..80acf47 100644 --- a/test/system/CMakeLists.txt +++ b/test/system/CMakeLists.txt @@ -18,18 +18,18 @@ if(USE_STAGED_BOOST) set(BOOST_HINTS HINTS ../../../../stage) endif() -if(USE_BOOST_PACKAGE) +# System is header-only in b2 starting from 1.89, so there's no `system` component anymore - find_package(Boost ${BOOST_VERSION} EXACT REQUIRED COMPONENTS system ${BOOST_HINTS}) +find_package(Boost ${BOOST_VERSION} EXACT REQUIRED OPTIONAL_COMPONENTS system ${BOOST_HINTS}) -else() +# Using `include_directories`, `link_directories`, `link_libraries` +# is bad practice, only done here for testing purposes. - find_package(boost_system ${BOOST_VERSION} EXACT CONFIG REQUIRED ${BOOST_HINTS}) - -endif() +include_directories(${Boost_INCLUDE_DIRS}) +link_directories(${Boost_LIBRARY_DIRS}) +link_libraries(${Boost_LIBRARIES}) add_executable(main quick.cpp) -target_link_libraries(main Boost::system) enable_testing() add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --no-tests=error -C $)