• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2018, 2019 Peter Dimov
2# Distributed under the Boost Software License, Version 1.0.
3# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
4
5cmake_minimum_required(VERSION 3.5...3.16)
6
7project(boost_cmake_test LANGUAGES CXX)
8
9include(CTest)
10
11set(BUILD_TESTING OFF) # hide cache variable
12
13add_subdirectory(../../../../libs/assert EXCLUDE_FROM_ALL boostorg/assert)
14add_subdirectory(../../../../libs/config EXCLUDE_FROM_ALL boostorg/config)
15add_subdirectory(../../../../libs/core EXCLUDE_FROM_ALL boostorg/core)
16
17unset(BUILD_TESTING)
18
19list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
20
21# boost_test
22
23include(BoostTest)
24
25boost_test(TYPE compile SOURCES compile.cpp)
26boost_test(TYPE compile-fail SOURCES compile_fail.cpp)
27boost_test(TYPE link SOURCES link.cpp)
28boost_test(TYPE link-fail SOURCES link_fail.cpp)
29boost_test(TYPE run SOURCES run.cpp)
30boost_test(TYPE run-fail SOURCES run_fail.cpp)
31
32boost_test(TYPE run SOURCES arguments.cpp ARGUMENTS pumpkin LINK_LIBRARIES Boost::core)
33
34boost_test(TYPE run NAME return_exit_code_pass SOURCES return_exit_code.cpp COMPILE_DEFINITIONS EXIT_CODE=0)
35boost_test(TYPE run-fail NAME return_exit_code_fail SOURCES return_exit_code.cpp COMPILE_DEFINITIONS EXIT_CODE=1)
36
37boost_test(TYPE run SOURCES requires_variadic_templates.cpp COMPILE_FEATURES cxx_variadic_templates)
38
39boost_test(TYPE run SOURCES requires_no_rtti.cpp COMPILE_OPTIONS -fno-rtti LINK_LIBRARIES Boost::config)
40boost_test(TYPE run SOURCES requires_no_exceptions.cpp COMPILE_OPTIONS -fno-exceptions LINK_LIBRARIES Boost::config)
41
42boost_test(TYPE compile-fail SOURCES emits_warning.cpp COMPILE_OPTIONS -Wall -Werror)
43
44# boost_test, w/ globals
45
46set(BOOST_TEST_COMPILE_OPTIONS -fno-rtti -fno-exceptions)
47set(BOOST_TEST_LINK_LIBRARIES Boost::config)
48
49boost_test(SOURCES requires_no_rtti.cpp PREFIX boost_cmake_test_globals)
50boost_test(SOURCES requires_no_exceptions.cpp PREFIX boost_cmake_test_globals)
51
52# boost_test_jamfile
53
54include(BoostTestJamfile)
55
56boost_test_jamfile(FILE Jamfile PREFIX boost_cmake_test_jamfile)
57