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

Bring back standalone functionality, but only when the library is the root project

This commit is contained in:
Peter Dimov
2025-10-27 13:45:12 +02:00
parent 8e8f913958
commit 2d50207f5d

View File

@@ -1,5 +1,6 @@
# Generated by `boostdep --cmake sort`
# Copyright 2020, 2021 Peter Dimov
# Copyright 2025 Nigel Stewart
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
@@ -21,8 +22,25 @@ target_link_libraries(boost_sort
Boost::type_traits
)
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
add_subdirectory(test)
message(STATUS "Using CMake version ${CMAKE_VERSION}")
set(Boost_DEBUG ON)
find_package(Boost 1.85 CONFIG REQUIRED COMPONENTS core range included_test_exec_monitor)
include(CTest)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
add_dependencies(check tests)
endif()
# Testing
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
# 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()