2025-10-19 10:52:58 +03:00
|
|
|
# Copyright 2018-2025 Peter Dimov
|
2018-09-20 00:55:16 +03:00
|
|
|
# Distributed under the Boost Software License, Version 1.0.
|
2023-01-12 05:38:07 +02:00
|
|
|
# https://www.boost.org/LICENSE_1_0.txt
|
2018-09-20 00:55:16 +03:00
|
|
|
|
2025-10-19 11:05:26 +03:00
|
|
|
# We support CMake 3.5, but prefer 3.31 policies and behavior
|
|
|
|
|
cmake_minimum_required(VERSION 3.5...3.31)
|
2018-09-20 00:55:16 +03:00
|
|
|
|
2019-12-15 20:10:02 +02:00
|
|
|
project(boost_assert VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
2018-09-17 11:38:41 +02:00
|
|
|
|
|
|
|
|
add_library(boost_assert INTERFACE)
|
|
|
|
|
add_library(Boost::assert ALIAS boost_assert)
|
|
|
|
|
|
2019-12-26 17:07:17 +02:00
|
|
|
target_include_directories(boost_assert INTERFACE include)
|
2018-09-17 11:38:41 +02:00
|
|
|
|
|
|
|
|
target_link_libraries(boost_assert
|
2019-12-27 04:00:29 +02:00
|
|
|
INTERFACE
|
|
|
|
|
Boost::config
|
2018-09-17 11:38:41 +02:00
|
|
|
)
|
2023-01-12 05:38:07 +02:00
|
|
|
|
2025-10-19 10:52:58 +03:00
|
|
|
# Add headers and .natvis to project, for better IDE integration
|
|
|
|
|
|
2025-10-19 13:59:23 +03:00
|
|
|
if(NOT CMAKE_VERSION VERSION_LESS 3.19)
|
2023-01-12 05:38:07 +02:00
|
|
|
|
2025-10-19 10:52:58 +03:00
|
|
|
# Using target_sources with PRIVATE or PUBLIC on INTERFACE targets requires 3.19
|
|
|
|
|
|
2025-10-19 11:50:12 +03:00
|
|
|
file(GLOB_RECURSE headers CONFIGURE_DEPENDS include/*.hpp)
|
|
|
|
|
target_sources(boost_assert PRIVATE ${headers})
|
|
|
|
|
unset(headers)
|
2023-01-12 05:38:07 +02:00
|
|
|
|
2025-10-19 11:00:46 +03:00
|
|
|
if(MSVC)
|
|
|
|
|
|
|
|
|
|
# Only Visual Studio needs this, but the generator may also be Ninja
|
|
|
|
|
target_sources(boost_assert PUBLIC extra/boost_assert.natvis)
|
|
|
|
|
|
|
|
|
|
endif()
|
2025-10-19 10:52:58 +03:00
|
|
|
|
2025-10-19 12:15:12 +03:00
|
|
|
# Make IDE project folders match directory structure
|
|
|
|
|
|
|
|
|
|
get_target_property(sources boost_assert SOURCES)
|
|
|
|
|
source_group(TREE ${PROJECT_SOURCE_DIR} FILES ${sources})
|
|
|
|
|
unset(sources)
|
|
|
|
|
|
2025-10-19 10:43:01 +03:00
|
|
|
endif()
|
2018-09-20 00:55:16 +03:00
|
|
|
|
2019-12-27 04:00:29 +02:00
|
|
|
# BUILD_TESTING is the standard CTest variable that enables testing
|
|
|
|
|
|
2019-12-15 20:10:02 +02:00
|
|
|
if(BUILD_TESTING)
|
2018-09-20 01:30:54 +03:00
|
|
|
|
2019-12-27 04:00:29 +02:00
|
|
|
add_subdirectory(test)
|
2018-09-20 00:55:16 +03:00
|
|
|
|
|
|
|
|
endif()
|