]>
Commit | Line | Data |
---|---|---|
b32b8144 | 1 | # Copyright 2014, Raffi Enficiaud |
7c673cae FG |
2 | |
3 | # Use, modification, and distribution are subject to the | |
4 | # Boost Software License, Version 1.0. (See accompanying file | |
5 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | # | |
7 | # See http://www.boost.org/libs/test for the library home page. | |
8 | ||
9 | cmake_minimum_required(VERSION 2.8.11) | |
10 | project(BoostTest) | |
11 | ||
12 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) | |
13 | set(CMAKE_MACOSX_RPATH ON) | |
14 | ||
15 | add_definitions(-DBOOST_TEST_NO_LIB) | |
16 | ||
b32b8144 | 17 | # build type, by default to release (with optimisations) |
7c673cae FG |
18 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) |
19 | message(STATUS "Setting build type to 'Release' as none was specified.") | |
20 | set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) | |
21 | # Set the possible values of build type for cmake-gui | |
22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") | |
23 | endif() | |
24 | ||
25 | if(NOT WITHOUT_TESTS) | |
26 | # ctest sets BUILD_TESTING automatically, but does not seem to serve its purpose. | |
27 | include(CTest) | |
28 | enable_testing() | |
29 | endif() | |
30 | ||
31 | ||
32 | include(CheckCXXCompilerFlag) | |
33 | include(CheckIncludeFileCXX) | |
34 | ||
35 | if(NOT MSVC) | |
36 | # c++11 options | |
37 | check_cxx_compiler_flag(-std=c++11 HAS_CXX11_FLAG) | |
38 | check_cxx_compiler_flag(-std=c++0x HAS_CXX0X_FLAG) | |
39 | if(HAS_CXX11_FLAG) | |
40 | message(STATUS "Compiling with C++11 support") | |
41 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | |
42 | elseif(HAS_CXX0X_FLAG) | |
43 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") | |
44 | endif() | |
45 | endif() | |
46 | ||
47 | if(MSVC) | |
48 | add_definitions(-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS) | |
49 | set(MSVC_Additional_flags "/fp:fast /GF /Oy /GT /Ox /Ob2 /Oi /Os") | |
50 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MSVC_Additional_flags}") | |
51 | endif() | |
52 | ||
53 | ||
7c673cae FG |
54 | # global path |
55 | set(BOOST_TEST_ROOT_DIR ${BoostTest_SOURCE_DIR}/..) | |
56 | set(BOOST_ROOT_DIR ${BOOST_TEST_ROOT_DIR}/../..) | |
57 | get_filename_component(BOOST_TEST_ROOT_DIR_ABS ${BoostTest_SOURCE_DIR}/.. ABSOLUTE) | |
58 | get_filename_component(BOOST_ROOT_DIR_ABS ${BOOST_ROOT_DIR} ABSOLUTE) | |
59 | ||
7c673cae FG |
60 | # include globs |
61 | file(GLOB_RECURSE | |
62 | BOOST_UTF_HEADERS | |
63 | ${BOOST_TEST_ROOT_DIR}/include/*.hpp | |
64 | ${BOOST_TEST_ROOT_DIR}/include/*.ipp) | |
65 | ||
66 | # organize files | |
67 | foreach(_h IN LISTS BOOST_UTF_HEADERS) | |
68 | get_filename_component(_hh ${_h} ABSOLUTE) | |
69 | file(RELATIVE_PATH _v ${BOOST_TEST_ROOT_DIR_ABS}/include/boost/test ${_hh}) | |
70 | get_filename_component(_v "${_v}" DIRECTORY) | |
71 | string(REPLACE "/" "\\" _v "${_v}") | |
72 | source_group(${_v} FILES ${_h}) | |
73 | endforeach() | |
74 | ||
75 | set(BOOST_UTF_SRC | |
76 | ${BOOST_TEST_ROOT_DIR}/src/compiler_log_formatter.cpp | |
77 | ||
78 | ${BOOST_TEST_ROOT_DIR}/src/debug.cpp | |
79 | ${BOOST_TEST_ROOT_DIR}/src/decorator.cpp | |
80 | ${BOOST_TEST_ROOT_DIR}/src/execution_monitor.cpp | |
81 | ${BOOST_TEST_ROOT_DIR}/src/framework.cpp | |
82 | ${BOOST_TEST_ROOT_DIR}/src/junit_log_formatter.cpp | |
83 | ${BOOST_TEST_ROOT_DIR}/src/plain_report_formatter.cpp | |
84 | ${BOOST_TEST_ROOT_DIR}/src/progress_monitor.cpp | |
85 | ${BOOST_TEST_ROOT_DIR}/src/results_collector.cpp | |
86 | ${BOOST_TEST_ROOT_DIR}/src/results_reporter.cpp | |
b32b8144 | 87 | ${BOOST_TEST_ROOT_DIR}/src/test_framework_init_observer.cpp |
7c673cae FG |
88 | ${BOOST_TEST_ROOT_DIR}/src/test_tools.cpp |
89 | ${BOOST_TEST_ROOT_DIR}/src/test_tree.cpp | |
90 | ${BOOST_TEST_ROOT_DIR}/src/unit_test_log.cpp | |
91 | ${BOOST_TEST_ROOT_DIR}/src/unit_test_main.cpp | |
92 | ${BOOST_TEST_ROOT_DIR}/src/unit_test_monitor.cpp | |
93 | ${BOOST_TEST_ROOT_DIR}/src/unit_test_parameters.cpp | |
94 | ${BOOST_TEST_ROOT_DIR}/src/xml_log_formatter.cpp | |
95 | ${BOOST_TEST_ROOT_DIR}/src/xml_report_formatter.cpp | |
f67539c2 | 96 | ) |
7c673cae FG |
97 | |
98 | add_library(boost_test_framework | |
99 | STATIC | |
100 | ${BOOST_UTF_HEADERS} | |
101 | ${BOOST_UTF_SRC}) | |
92f5a8d4 | 102 | #target_compile_definitions(boost_test_framework PUBLIC "-DBOOST_TEST_DYN_LINK=0") |
f67539c2 TL |
103 | target_include_directories(boost_test_framework |
104 | PUBLIC | |
105 | ${BOOST_TEST_ROOT_DIR}/include/ | |
106 | ${BOOST_ROOT_DIR_ABS}/) | |
7c673cae FG |
107 | set_target_properties(boost_test_framework PROPERTIES FOLDER "UTF") |
108 | ||
92f5a8d4 TL |
109 | add_library(boost_test_framework_shared |
110 | SHARED | |
111 | ${BOOST_UTF_HEADERS} | |
112 | ${BOOST_UTF_SRC}) | |
113 | target_compile_definitions(boost_test_framework_shared PUBLIC "-DBOOST_TEST_DYN_LINK=1") | |
f67539c2 TL |
114 | target_include_directories(boost_test_framework_shared |
115 | PUBLIC | |
116 | ${BOOST_TEST_ROOT_DIR}/include/ | |
117 | ${BOOST_ROOT_DIR_ABS}/) | |
92f5a8d4 TL |
118 | set_target_properties(boost_test_framework_shared PROPERTIES FOLDER "UTF") |
119 | ||
7c673cae FG |
120 | #### |
121 | # Documentation files (files only, no target) | |
122 | file(GLOB_RECURSE | |
123 | BOOST_UTF_DOC_FILES | |
124 | ${BOOST_TEST_ROOT_DIR}/doc/*.qbk) | |
125 | add_custom_target( | |
126 | quickbook | |
127 | SOURCES ${BOOST_UTF_DOC_FILES}) | |
128 | set_property(TARGET quickbook PROPERTY FOLDER "Documentation/") | |
129 | ||
7c673cae | 130 | # Unit tests |
f67539c2 | 131 | add_subdirectory(${BOOST_TEST_ROOT_DIR}/test tmp_folders_tests) |