Files
assert/CMakeLists.txt

52 lines
1.3 KiB
CMake
Raw Permalink Normal View History

# 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)
add_library(boost_assert INTERFACE)
add_library(Boost::assert ALIAS boost_assert)
target_include_directories(boost_assert INTERFACE include)
target_link_libraries(boost_assert
INTERFACE
Boost::config
)
2023-01-12 05:38:07 +02: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
# Using target_sources with PRIVATE or PUBLIC on INTERFACE targets requires 3.19
file(GLOB_RECURSE headers CONFIGURE_DEPENDS include/*.hpp)
target_sources(boost_assert PRIVATE ${headers})
unset(headers)
2023-01-12 05:38:07 +02: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()
# Make IDE project folders match directory structure
get_target_property(sources boost_assert SOURCES)
source_group(TREE ${PROJECT_SOURCE_DIR} FILES ${sources})
unset(sources)
endif()
2018-09-20 00:55:16 +03:00
# BUILD_TESTING is the standard CTest variable that enables testing
2019-12-15 20:10:02 +02:00
if(BUILD_TESTING)
add_subdirectory(test)
2018-09-20 00:55:16 +03:00
endif()