2
0
mirror of https://github.com/boostorg/sort.git synced 2026-01-19 04:42:11 +00:00

cmake: Standalone build support refinement, review feedback

This commit is contained in:
Nigel Stewart
2025-09-09 07:36:57 +10:00
parent de047e1250
commit 08ee0e89f3
2 changed files with 6 additions and 17 deletions

View File

@@ -15,16 +15,9 @@ else()
endif()
# Test coverage in stand-alone mode requires boost dependencies
if(NOT BOOST_SUPERPROJECT_VERSION)
if(BUILD_TESTING)
set(Boost_DEBUG ON)
find_package(Boost 1.85 REQUIRED COMPONENTS core range included_test_exec_monitor)
if(NOT Boost_FOUND)
message(STATUS "Boost 1.85 (or later) is required")
return()
endif()
endif()
if(BUILD_TESTING AND NOT BOOST_SUPERPROJECT_VERSION)
set(Boost_DEBUG ON)
find_package(Boost 1.85 REQUIRED COMPONENTS core range included_test_exec_monitor)
endif()
add_library(boost_sort INTERFACE)
@@ -42,7 +35,6 @@ target_link_libraries(boost_sort
)
# Testing
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
if(NOT BOOST_SUPERPROJECT_VERSION)
@@ -52,5 +44,7 @@ if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_dependencies(check tests)
endif()
add_subdirectory(test)
# Follow the Boost convention: don't build test targets by default,
# and only when explicitly requested by building target tests
add_subdirectory(test EXCLUDE_FROM_ALL)
endif()

View File

@@ -26,11 +26,6 @@ function(boost_sort_add_test name source)
set(pname "${PREFIX}${name}")
add_executable(${pname} ${source})
target_link_libraries(${pname} ${LINK_LIBRARIES})
# Follow the Boost convention: don't build test targets by default,
# and only when explicitly requested by building target tests
set_target_properties(${pname} PROPERTIES EXCLUDE_FROM_ALL ON)
add_test(NAME ${pname} COMMAND ${pname})
add_dependencies(tests ${pname})
endfunction()