summaryrefslogtreecommitdiffstats
path: root/src/boost/tools/cmake/test/boost_test/CMakeLists.txt
blob: 22dfaad0b580105e3827359fe11ca8e32fc23c32 (plain)
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
# Copyright 2018, 2019 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

cmake_minimum_required(VERSION 3.5...3.16)

project(boost_cmake_test LANGUAGES CXX)

include(CTest)

set(BUILD_TESTING OFF) # hide cache variable

add_subdirectory(../../../../libs/assert EXCLUDE_FROM_ALL boostorg/assert)
add_subdirectory(../../../../libs/config EXCLUDE_FROM_ALL boostorg/config)
add_subdirectory(../../../../libs/core EXCLUDE_FROM_ALL boostorg/core)
add_subdirectory(../../../../libs/static_assert EXCLUDE_FROM_ALL boostorg/static_assert)
add_subdirectory(../../../../libs/throw_exception EXCLUDE_FROM_ALL boostorg/throw_exception)

unset(BUILD_TESTING)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../include)

# boost_test

include(BoostTest)

boost_test(TYPE compile SOURCES compile.cpp)
boost_test(TYPE compile-fail SOURCES compile_fail.cpp)
boost_test(TYPE link SOURCES link.cpp)
boost_test(TYPE link-fail SOURCES link_fail.cpp)
boost_test(TYPE run SOURCES run.cpp)
boost_test(TYPE run-fail SOURCES run_fail.cpp)

boost_test(TYPE run SOURCES arguments.cpp ARGUMENTS pumpkin LINK_LIBRARIES Boost::core)

boost_test(TYPE run NAME return_exit_code_pass SOURCES return_exit_code.cpp COMPILE_DEFINITIONS EXIT_CODE=0)
boost_test(TYPE run-fail NAME return_exit_code_fail SOURCES return_exit_code.cpp COMPILE_DEFINITIONS EXIT_CODE=1)

boost_test(TYPE run SOURCES requires_variadic_templates.cpp COMPILE_FEATURES cxx_variadic_templates)

boost_test(TYPE run SOURCES requires_no_rtti.cpp COMPILE_OPTIONS -fno-rtti LINK_LIBRARIES Boost::config)
boost_test(TYPE run SOURCES requires_no_exceptions.cpp COMPILE_OPTIONS -fno-exceptions LINK_LIBRARIES Boost::config)

boost_test(TYPE compile-fail SOURCES emits_warning.cpp COMPILE_OPTIONS -Wall -Werror)

# boost_test, w/ globals

set(BOOST_TEST_COMPILE_OPTIONS -fno-rtti -fno-exceptions)
set(BOOST_TEST_LINK_LIBRARIES Boost::config)

boost_test(SOURCES requires_no_rtti.cpp PREFIX boost_cmake_test_globals)
boost_test(SOURCES requires_no_exceptions.cpp PREFIX boost_cmake_test_globals)

# boost_test_jamfile

include(BoostTestJamfile)

boost_test_jamfile(FILE Jamfile PREFIX boost_cmake_test_jamfile)