@@ -18,32 +18,19 @@ if(USE_STAGED_BOOST)
1818 set (BOOST_HINTS HINTS ../../../../stage)
1919endif ()
2020
21- if (USE_BOOST_PACKAGE)
21+ # Regex is header-only in b2 starting from 1.89, so there's no `regex` component anymore
2222
23- find_package (Boost ${BOOST_VERSION} EXACT REQUIRED COMPONENTS regex ${BOOST_HINTS} )
23+ find_package (Boost ${BOOST_VERSION} EXACT REQUIRED OPTIONAL_COMPONENTS regex ${BOOST_HINTS} )
2424
25- # Using `include_directories`, `link_directories`, `link_libraries`
26- # is bad practice, done here for testing purposes. The right, "modern
27- # CMake", thing to do is `target_link_libraries(main Boost::regex)`.
25+ # Using `include_directories`, `link_directories`, `link_libraries`
26+ # is bad practice, only done here for testing purposes.
2827
29- include_directories (${Boost_INCLUDE_DIRS} )
30- link_directories (${Boost_LIBRARY_DIRS} )
31- link_libraries (${Boost_LIBRARIES} )
32-
33- else ()
34-
35- find_package (boost_regex ${BOOST_VERSION} EXACT CONFIG REQUIRED ${BOOST_HINTS} )
36-
37- endif ()
28+ include_directories (${Boost_INCLUDE_DIRS} )
29+ link_directories (${Boost_LIBRARY_DIRS} )
30+ link_libraries (${Boost_LIBRARIES} )
3831
3932add_executable (main quick.cpp )
4033
41- if (NOT USE_BOOST_PACKAGE)
42-
43- target_link_libraries (main Boost::regex )
44-
45- endif ()
46-
4734enable_testing ()
4835add_custom_target (check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --no-tests=error -C $<CONFIG >)
4936
0 commit comments