1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
# Copyright 2020, 2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_test VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
# Dependencies (please retain formatting, one target per line, no punct.)
set(_boost_test_dependencies
Boost::algorithm
Boost::assert
Boost::bind
Boost::config
Boost::core
Boost::detail
Boost::describe
Boost::exception
Boost::function
Boost::io
Boost::iterator
Boost::mpl
Boost::numeric_conversion
Boost::optional
Boost::preprocessor
Boost::smart_ptr
Boost::static_assert
Boost::type_traits
Boost::utility
)
# Compiled targets
function(boost_test_add_library name)
add_library(boost_${name} ${ARGN})
add_library(Boost::${name} ALIAS boost_${name})
target_include_directories(boost_${name} PUBLIC include)
target_link_libraries(boost_${name} PUBLIC ${_boost_test_dependencies})
target_compile_definitions(boost_${name}
PUBLIC BOOST_TEST_NO_LIB
# Source files already define BOOST_TEST_SOURCE
# PRIVATE BOOST_TEST_SOURCE
)
if(BUILD_SHARED_LIBS)
target_compile_definitions(boost_${name} PUBLIC BOOST_TEST_DYN_LINK)
else()
target_compile_definitions(boost_${name} PUBLIC BOOST_TEST_STATIC_LINK)
endif()
endfunction()
boost_test_add_library(prg_exec_monitor
src/cpp_main.cpp
src/debug.cpp
src/execution_monitor.cpp
)
set(SOURCES
src/compiler_log_formatter.cpp
src/debug.cpp
src/decorator.cpp
src/execution_monitor.cpp
src/framework.cpp
src/junit_log_formatter.cpp
src/plain_report_formatter.cpp
src/progress_monitor.cpp
src/results_collector.cpp
src/results_reporter.cpp
src/test_framework_init_observer.cpp
src/test_tools.cpp
src/test_tree.cpp
src/unit_test_log.cpp
src/unit_test_main.cpp
src/unit_test_monitor.cpp
src/unit_test_parameters.cpp
src/xml_log_formatter.cpp
src/xml_report_formatter.cpp
)
boost_test_add_library(test_exec_monitor STATIC ${SOURCES} src/test_main.cpp)
boost_test_add_library(unit_test_framework ${SOURCES})
# Header-only targets
function(boost_test_add_included_library name)
add_library(boost_${name} INTERFACE)
add_library(Boost::${name} ALIAS boost_${name})
target_include_directories(boost_${name} INTERFACE include)
target_link_libraries(boost_${name} INTERFACE ${_boost_test_dependencies})
endfunction()
boost_test_add_included_library(included_prg_exec_monitor)
boost_test_add_included_library(included_test_exec_monitor)
boost_test_add_included_library(included_unit_test_framework)
# Installation
if(BOOST_SUPERPROJECT_VERSION AND NOT CMAKE_VERSION VERSION_LESS 3.13)
boost_install(
TARGETS
boost_prg_exec_monitor boost_test_exec_monitor boost_unit_test_framework
boost_included_prg_exec_monitor boost_included_test_exec_monitor boost_included_unit_test_framework
VERSION ${BOOST_SUPERPROJECT_VERSION}
HEADER_DIRECTORY include
)
endif()
|