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
5 cmake_minimum_required(VERSION 3.5...3.16)
7 project(boost_cmake_test LANGUAGES CXX)
11 set(BUILD_TESTING OFF) # hide cache variable
13 add_subdirectory(../../../../libs/assert EXCLUDE_FROM_ALL boostorg/assert)
14 add_subdirectory(../../../../libs/config EXCLUDE_FROM_ALL boostorg/config)
15 add_subdirectory(../../../../libs/core EXCLUDE_FROM_ALL boostorg/core)
19 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
25 boost_test(TYPE compile SOURCES compile.cpp)
26 boost_test(TYPE compile-fail SOURCES compile_fail.cpp)
27 boost_test(TYPE link SOURCES link.cpp)
28 boost_test(TYPE link-fail SOURCES link_fail.cpp)
29 boost_test(TYPE run SOURCES run.cpp)
30 boost_test(TYPE run-fail SOURCES run_fail.cpp)
32 boost_test(TYPE run SOURCES arguments.cpp ARGUMENTS pumpkin LINK_LIBRARIES Boost::core)
34 boost_test(TYPE run NAME return_exit_code_pass SOURCES return_exit_code.cpp COMPILE_DEFINITIONS EXIT_CODE=0)
35 boost_test(TYPE run-fail NAME return_exit_code_fail SOURCES return_exit_code.cpp COMPILE_DEFINITIONS EXIT_CODE=1)
37 boost_test(TYPE run SOURCES requires_variadic_templates.cpp COMPILE_FEATURES cxx_variadic_templates)
39 boost_test(TYPE run SOURCES requires_no_rtti.cpp COMPILE_OPTIONS -fno-rtti LINK_LIBRARIES Boost::config)
40 boost_test(TYPE run SOURCES requires_no_exceptions.cpp COMPILE_OPTIONS -fno-exceptions LINK_LIBRARIES Boost::config)
42 boost_test(TYPE compile-fail SOURCES emits_warning.cpp COMPILE_OPTIONS -Wall -Werror)
44 # boost_test, w/ globals
46 set(BOOST_TEST_COMPILE_OPTIONS -fno-rtti -fno-exceptions)
47 set(BOOST_TEST_LINK_LIBRARIES Boost::config)
49 boost_test(SOURCES requires_no_rtti.cpp PREFIX boost_cmake_test_globals)
50 boost_test(SOURCES requires_no_exceptions.cpp PREFIX boost_cmake_test_globals)
54 include(BoostTestJamfile)
56 boost_test_jamfile(FILE Jamfile PREFIX boost_cmake_test_jamfile)