mirror of
https://github.com/boostorg/boost_install.git
synced 2026-01-19 04:02:13 +00:00
Update the CMakeLists.txt files for System and Regex, because they are header-only in 1.89 and above and no longer have components
This commit is contained in:
@@ -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 $<CONFIG>)
|
||||
|
||||
|
||||
@@ -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 $<CONFIG>)
|
||||
|
||||
Reference in New Issue
Block a user