blob: c8a17f18487824a3f729c8f71691961294371483 [file] [log] [blame]
Martin Hořeňovský50c95a02017-01-31 20:21:03 +01001cmake_minimum_required(VERSION 3.0)
Kostace441a92013-08-05 12:40:33 +02002
Phil Nash0bcae642017-01-09 17:32:57 +00003project(CatchSelfTest)
Kostace441a92013-08-05 12:40:33 +02004
Phil Nash8abe17a2017-01-09 16:27:06 +00005set_property(GLOBAL PROPERTY USE_FOLDERS ON)
6
Kostace441a92013-08-05 12:40:33 +02007# define some folders
Phil Nashc8fefc42017-01-06 16:19:20 +00008set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Kostace441a92013-08-05 12:40:33 +02009set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
Martin Hořeňovský3b7511e2017-01-14 21:55:37 +010010set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark)
Phil Nashe1fbbe12017-01-06 16:59:18 +000011set(HEADER_DIR ${CATCH_DIR}/include)
12
Phil Nash073377a2017-04-25 11:06:28 +010013if(USE_CPP14)
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +010014 message(STATUS "Enabling C++14")
15 set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}")
Phil Nash073377a2017-04-25 11:06:28 +010016else()
17 message(STATUS "Enabling C++11")
18 set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
19
Andy Sawyer13cbdf72014-09-04 00:32:05 +010020endif()
Kostace441a92013-08-05 12:40:33 +020021
Antonio Di Monacob8443e62017-05-11 13:00:03 +020022if(USE_WMAIN)
23 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
24endif()
25
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +010026#checks that the given hard-coded list contains all headers + sources in the given folder
27function(CheckFileList LIST_VAR FOLDER)
28 set(MESSAGE " should be added to the variable ${LIST_VAR}")
29 set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n")
30 file(GLOB GLOBBED_LIST "${FOLDER}/*.cpp"
31 "${FOLDER}/*.hpp"
32 "${FOLDER}/*.h")
33 list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}})
34 foreach(EXTRA_ITEM ${GLOBBED_LIST})
35 string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}")
36 message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}")
37 endforeach()
38endfunction()
39
40function(CheckFileListRec LIST_VAR FOLDER)
41 set(MESSAGE " should be added to the variable ${LIST_VAR}")
42 set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n")
43 file(GLOB_RECURSE GLOBBED_LIST "${FOLDER}/*.cpp"
44 "${FOLDER}/*.hpp"
45 "${FOLDER}/*.h")
46 list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}})
47 foreach(EXTRA_ITEM ${GLOBBED_LIST})
48 string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}")
49 message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}")
50 endforeach()
51endfunction()
52
Kostace441a92013-08-05 12:40:33 +020053# define the sources of the self test
Phil Nashd5360e82017-01-12 11:54:53 +000054# Please keep these ordered alphabetically
Phil Nash8abe17a2017-01-09 16:27:06 +000055set(TEST_SOURCES
Phil Nash30cebd62016-11-09 22:55:32 +000056 ${SELF_TEST_DIR}/ApproxTests.cpp
57 ${SELF_TEST_DIR}/BDDTests.cpp
Phil Nashf45d35c2017-08-05 11:12:29 +010058 ${SELF_TEST_DIR}/Benchmark.tests.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000059 ${SELF_TEST_DIR}/ClassTests.cpp
Phil Nashd5360e82017-01-12 11:54:53 +000060 ${SELF_TEST_DIR}/CmdLineTests.cpp
Martin Hořeňovský7db4d8d2017-02-07 13:32:48 +010061 ${SELF_TEST_DIR}/CompilationTests.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000062 ${SELF_TEST_DIR}/ConditionTests.cpp
Martin Hořeňovskýea48ae02017-05-27 14:42:05 +020063 ${SELF_TEST_DIR}/DecompositionTests.cpp
Phil Nashd5360e82017-01-12 11:54:53 +000064 ${SELF_TEST_DIR}/EnumToString.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000065 ${SELF_TEST_DIR}/ExceptionTests.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000066 ${SELF_TEST_DIR}/MessageTests.cpp
67 ${SELF_TEST_DIR}/MiscTests.cpp
68 ${SELF_TEST_DIR}/PartTrackerTests.cpp
Phil Nashd5360e82017-01-12 11:54:53 +000069 ${SELF_TEST_DIR}/TagAliasTests.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000070 ${SELF_TEST_DIR}/TestMain.cpp
Martin Hořeňovský7db4d8d2017-02-07 13:32:48 +010071 ${SELF_TEST_DIR}/ToStringGeneralTests.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000072 ${SELF_TEST_DIR}/ToStringPair.cpp
Phil Nashd5360e82017-01-12 11:54:53 +000073 ${SELF_TEST_DIR}/ToStringTuple.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000074 ${SELF_TEST_DIR}/ToStringVector.cpp
75 ${SELF_TEST_DIR}/ToStringWhich.cpp
Phil Nashd5360e82017-01-12 11:54:53 +000076 ${SELF_TEST_DIR}/TrickyTests.cpp
77 ${SELF_TEST_DIR}/VariadicMacrosTests.cpp
Phil Nash4e6938d2017-02-21 14:19:09 +000078 ${SELF_TEST_DIR}/MatchersTests.cpp
Phil Nash78e79942017-06-29 11:18:14 +010079 ${SELF_TEST_DIR}/StringRef.tests.cpp
Phil Nash8abe17a2017-01-09 16:27:06 +000080 )
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +010081CheckFileList(TEST_SOURCES ${SELF_TEST_DIR})
Phil Nashd5360e82017-01-12 11:54:53 +000082
83# A set of impl files that just #include a single header
84# Please keep these ordered alphabetically
Martin Hořeňovskýfc321652017-07-06 22:28:42 +020085set(SURROGATE_SOURCES
Phil Nash30cebd62016-11-09 22:55:32 +000086 ${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp
87 ${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000088 ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000089 ${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000090 ${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp
Phil Nashf45d35c2017-08-05 11:12:29 +010091 ${SELF_TEST_DIR}/SurrogateCpps/catch_test_case_tracker.cpp
Phil Nash30cebd62016-11-09 22:55:32 +000092 ${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp
93 ${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp
94 )
Martin Hořeňovskýfc321652017-07-06 22:28:42 +020095CheckFileList(SURROGATE_SOURCES ${SELF_TEST_DIR}/SurrogateCpps)
Kostace441a92013-08-05 12:40:33 +020096
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +010097
Phil Nashd5360e82017-01-12 11:54:53 +000098# Please keep these ordered alphabetically
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +010099set(TOP_LEVEL_HEADERS
Phil Nashe1fbbe12017-01-06 16:59:18 +0000100 ${HEADER_DIR}/catch.hpp
Phil Nashe1fbbe12017-01-06 16:59:18 +0000101 ${HEADER_DIR}/catch_with_main.hpp
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +0100102 )
103CheckFileList(TOP_LEVEL_HEADERS ${HEADER_DIR})
Martin Hořeňovskýdab1d9d2017-01-25 23:02:25 +0100104
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +0100105# Please keep these ordered alphabetically
106set(EXTERNAL_HEADERS
Phil Nash1c223b62017-06-12 23:04:24 +0100107 ${HEADER_DIR}/external/clara.hpp
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +0100108 )
109CheckFileList(EXTERNAL_HEADERS ${HEADER_DIR}/external)
110
Martin Hořeňovskýdab1d9d2017-01-25 23:02:25 +0100111
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +0100112# Please keep these ordered alphabetically
113set(INTERNAL_HEADERS
Phil Nashca7021a2017-09-07 12:58:44 +0100114 ${HEADER_DIR}/internal/catch_approx.h
Phil Nashf247ce52017-08-08 17:53:01 +0100115 ${HEADER_DIR}/internal/catch_assertionhandler.h
116 ${HEADER_DIR}/internal/catch_assertioninfo.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000117 ${HEADER_DIR}/internal/catch_assertionresult.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000118 ${HEADER_DIR}/internal/catch_capture.hpp
Phil Nashee9b19e2017-08-09 12:10:14 +0100119 ${HEADER_DIR}/internal/catch_capture_matchers.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000120 ${HEADER_DIR}/internal/catch_clara.h
Phil Nashca7021a2017-09-07 12:58:44 +0100121 ${HEADER_DIR}/internal/catch_commandline.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000122 ${HEADER_DIR}/internal/catch_common.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000123 ${HEADER_DIR}/internal/catch_compiler_capabilities.h
124 ${HEADER_DIR}/internal/catch_config.hpp
Phil Nashca7021a2017-09-07 12:58:44 +0100125 ${HEADER_DIR}/internal/catch_console_colour.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000126 ${HEADER_DIR}/internal/catch_context.h
Martin Hořeňovský59325762017-08-29 13:51:55 +0200127 ${HEADER_DIR}/internal/catch_debug_console.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000128 ${HEADER_DIR}/internal/catch_debugger.h
Phil Nashf247ce52017-08-08 17:53:01 +0100129 ${HEADER_DIR}/internal/catch_decomposer.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000130 ${HEADER_DIR}/internal/catch_default_main.hpp
Martin Hořeňovskýfeca97d2017-08-01 18:46:33 +0200131 ${HEADER_DIR}/internal/catch_enforce.h
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200132 ${HEADER_DIR}/internal/catch_errno_guard.h
Martin Hořeňovský1d3bfa02017-07-10 14:25:38 +0200133 ${HEADER_DIR}/internal/catch_exception_translator_registry.h
Martin Hořeňovský24af32f2017-08-17 20:21:06 +0200134 ${HEADER_DIR}/internal/catch_external_interfaces.h
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200135 ${HEADER_DIR}/internal/catch_fatal_condition.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000136 ${HEADER_DIR}/internal/catch_impl.hpp
137 ${HEADER_DIR}/internal/catch_interfaces_capture.h
138 ${HEADER_DIR}/internal/catch_interfaces_config.h
139 ${HEADER_DIR}/internal/catch_interfaces_exception.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000140 ${HEADER_DIR}/internal/catch_interfaces_registry_hub.h
141 ${HEADER_DIR}/internal/catch_interfaces_reporter.h
142 ${HEADER_DIR}/internal/catch_interfaces_runner.h
143 ${HEADER_DIR}/internal/catch_interfaces_tag_alias_registry.h
144 ${HEADER_DIR}/internal/catch_interfaces_testcase.h
Martin Hořeňovský4332b842017-07-12 14:47:36 +0200145 ${HEADER_DIR}/internal/catch_leak_detector.h
Martin Hořeňovský1d3bfa02017-07-10 14:25:38 +0200146 ${HEADER_DIR}/internal/catch_list.h
Phil Nashca7021a2017-09-07 12:58:44 +0100147 ${HEADER_DIR}/internal/catch_matchers.h
Phil Nash14001272017-02-08 15:14:51 +0000148 ${HEADER_DIR}/internal/catch_matchers_string.h
Phil Nash10dfca32017-02-21 16:05:04 +0000149 ${HEADER_DIR}/internal/catch_matchers_vector.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000150 ${HEADER_DIR}/internal/catch_message.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000151 ${HEADER_DIR}/internal/catch_objc.hpp
152 ${HEADER_DIR}/internal/catch_objc_arc.hpp
153 ${HEADER_DIR}/internal/catch_option.hpp
154 ${HEADER_DIR}/internal/catch_platform.h
Martin Hořeňovský0673b9b2017-08-30 15:32:44 +0200155 ${HEADER_DIR}/internal/catch_random_number_generator.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000156 ${HEADER_DIR}/internal/catch_reenable_warnings.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000157 ${HEADER_DIR}/internal/catch_reporter_registrars.hpp
Martin Hořeňovský9aa96712017-09-07 16:51:33 +0200158 ${HEADER_DIR}/internal/catch_reporter_registry.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000159 ${HEADER_DIR}/internal/catch_result_type.h
Phil Nashca7021a2017-09-07 12:58:44 +0100160 ${HEADER_DIR}/internal/catch_run_context.h
Phil Nasha9b68132017-08-04 19:23:30 +0100161 ${HEADER_DIR}/internal/catch_benchmark.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000162 ${HEADER_DIR}/internal/catch_section.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000163 ${HEADER_DIR}/internal/catch_section_info.h
Martin Hořeňovskýe8717422017-08-31 10:31:52 +0200164 ${HEADER_DIR}/internal/catch_session.h
Martin Hořeňovskýda0edcb2017-06-04 21:39:27 +0200165 ${HEADER_DIR}/internal/catch_startup_exception_registry.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000166 ${HEADER_DIR}/internal/catch_stream.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000167 ${HEADER_DIR}/internal/catch_streambuf.h
Phil Nash78e79942017-06-29 11:18:14 +0100168 ${HEADER_DIR}/internal/catch_stringref.h
Martin Hořeňovský1a961752017-07-25 21:57:35 +0200169 ${HEADER_DIR}/internal/catch_string_manip.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000170 ${HEADER_DIR}/internal/catch_suppress_warnings.h
171 ${HEADER_DIR}/internal/catch_tag_alias.h
Martin Hořeňovský33fd54a2017-07-27 11:55:30 +0200172 ${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000173 ${HEADER_DIR}/internal/catch_tag_alias_registry.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000174 ${HEADER_DIR}/internal/catch_test_case_info.h
Phil Nashca7021a2017-09-07 12:58:44 +0100175 ${HEADER_DIR}/internal/catch_test_case_registry_impl.h
176 ${HEADER_DIR}/internal/catch_test_case_tracker.h
177 ${HEADER_DIR}/internal/catch_test_registry.h
178 ${HEADER_DIR}/internal/catch_test_spec.h
179 ${HEADER_DIR}/internal/catch_test_spec_parser.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000180 ${HEADER_DIR}/internal/catch_text.h
181 ${HEADER_DIR}/internal/catch_timer.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000182 ${HEADER_DIR}/internal/catch_tostring.h
Phil Nashca7021a2017-09-07 12:58:44 +0100183 ${HEADER_DIR}/internal/catch_totals.h
Phil Nashe1fbbe12017-01-06 16:59:18 +0000184 ${HEADER_DIR}/internal/catch_version.h
Phil Nashca7021a2017-09-07 12:58:44 +0100185 ${HEADER_DIR}/internal/catch_wildcard_pattern.h
Martin Hořeňovský531d2672017-01-16 19:56:57 +0100186 ${HEADER_DIR}/internal/catch_windows_h_proxy.h
Phil Nashca7021a2017-09-07 12:58:44 +0100187 ${HEADER_DIR}/internal/catch_xmlwriter.h
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +0100188 )
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200189set(IMPL_SOURCES
Martin Hořeňovskýedbe1222017-07-19 10:01:06 +0200190 ${HEADER_DIR}/internal/catch_approx.cpp
Phil Nashf247ce52017-08-08 17:53:01 +0100191 ${HEADER_DIR}/internal/catch_assertionhandler.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200192 ${HEADER_DIR}/internal/catch_assertionresult.cpp
Phil Nasha9b68132017-08-04 19:23:30 +0100193 ${HEADER_DIR}/internal/catch_benchmark.cpp
Phil Nashee9b19e2017-08-09 12:10:14 +0100194 ${HEADER_DIR}/internal/catch_capture_matchers.cpp
Martin Hořeňovský1d3bfa02017-07-10 14:25:38 +0200195 ${HEADER_DIR}/internal/catch_commandline.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200196 ${HEADER_DIR}/internal/catch_common.cpp
Martin Hořeňovský4a1e8982017-07-19 10:13:47 +0200197 ${HEADER_DIR}/internal/catch_config.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200198 ${HEADER_DIR}/internal/catch_console_colour.cpp
199 ${HEADER_DIR}/internal/catch_context.cpp
Martin Hořeňovský59325762017-08-29 13:51:55 +0200200 ${HEADER_DIR}/internal/catch_debug_console.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200201 ${HEADER_DIR}/internal/catch_debugger.cpp
Phil Nashf247ce52017-08-08 17:53:01 +0100202 ${HEADER_DIR}/internal/catch_decomposer.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200203 ${HEADER_DIR}/internal/catch_errno_guard.cpp
Martin Hořeňovský1d3bfa02017-07-10 14:25:38 +0200204 ${HEADER_DIR}/internal/catch_exception_translator_registry.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200205 ${HEADER_DIR}/internal/catch_fatal_condition.cpp
Martin Hořeňovský9aa96712017-09-07 16:51:33 +0200206 ${HEADER_DIR}/internal/catch_interfaces_capture.cpp
207 ${HEADER_DIR}/internal/catch_interfaces_config.cpp
208 ${HEADER_DIR}/internal/catch_interfaces_exception.cpp
209 ${HEADER_DIR}/internal/catch_interfaces_registry_hub.cpp
210 ${HEADER_DIR}/internal/catch_interfaces_runner.cpp
211 ${HEADER_DIR}/internal/catch_interfaces_testcase.cpp
Martin Hořeňovský1d3bfa02017-07-10 14:25:38 +0200212 ${HEADER_DIR}/internal/catch_list.cpp
Martin Hořeňovský4332b842017-07-12 14:47:36 +0200213 ${HEADER_DIR}/internal/catch_leak_detector.cpp
Martin Hořeňovský87a66b82017-07-20 00:27:28 +0200214 ${HEADER_DIR}/internal/catch_matchers.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200215 ${HEADER_DIR}/internal/catch_matchers_string.cpp
216 ${HEADER_DIR}/internal/catch_message.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200217 ${HEADER_DIR}/internal/catch_registry_hub.cpp
Martin Hořeňovský4a1e8982017-07-19 10:13:47 +0200218 ${HEADER_DIR}/internal/catch_interfaces_reporter.cpp
Martin Hořeňovský0673b9b2017-08-30 15:32:44 +0200219 ${HEADER_DIR}/internal/catch_random_number_generator.cpp
Martin Hořeňovský9aa96712017-09-07 16:51:33 +0200220 ${HEADER_DIR}/internal/catch_reporter_registry.cpp
Martin Hořeňovský8d8f4812017-07-12 16:07:10 +0200221 ${HEADER_DIR}/internal/catch_result_type.cpp
Martin Hořeňovský7ccf11d2017-07-15 16:48:21 +0200222 ${HEADER_DIR}/internal/catch_run_context.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200223 ${HEADER_DIR}/internal/catch_section.cpp
Martin Hořeňovskýd4e796c2017-08-01 17:51:32 +0200224 ${HEADER_DIR}/internal/catch_section_info.cpp
Martin Hořeňovskýe8717422017-08-31 10:31:52 +0200225 ${HEADER_DIR}/internal/catch_session.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200226 ${HEADER_DIR}/internal/catch_startup_exception_registry.cpp
Martin Hořeňovský11295a22017-08-10 11:45:05 +0200227 ${HEADER_DIR}/internal/catch_stream.cpp
Martin Hořeňovský9aa96712017-09-07 16:51:33 +0200228 ${HEADER_DIR}/internal/catch_streambuf.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200229 ${HEADER_DIR}/internal/catch_stringref.cpp
Martin Hořeňovský1a961752017-07-25 21:57:35 +0200230 ${HEADER_DIR}/internal/catch_string_manip.cpp
Martin Hořeňovský9de729b2017-07-25 22:13:14 +0200231 ${HEADER_DIR}/internal/catch_tag_alias.cpp
Martin Hořeňovský33fd54a2017-07-27 11:55:30 +0200232 ${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200233 ${HEADER_DIR}/internal/catch_tag_alias_registry.cpp
234 ${HEADER_DIR}/internal/catch_test_case_info.cpp
Martin Hořeňovskýa75eaa32017-07-25 22:41:35 +0200235 ${HEADER_DIR}/internal/catch_test_case_registry_impl.cpp
Martin Hořeňovský4a1e8982017-07-19 10:13:47 +0200236 ${HEADER_DIR}/internal/catch_test_case_tracker.cpp
Martin Hořeňovskýa75eaa32017-07-25 22:41:35 +0200237 ${HEADER_DIR}/internal/catch_test_registry.cpp
Martin Hořeňovský4a1e8982017-07-19 10:13:47 +0200238 ${HEADER_DIR}/internal/catch_test_spec.cpp
239 ${HEADER_DIR}/internal/catch_test_spec_parser.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200240 ${HEADER_DIR}/internal/catch_timer.cpp
241 ${HEADER_DIR}/internal/catch_tostring.cpp
Martin Hořeňovský4a1e8982017-07-19 10:13:47 +0200242 ${HEADER_DIR}/internal/catch_totals.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200243 ${HEADER_DIR}/internal/catch_version.cpp
Martin Hořeňovský4a1e8982017-07-19 10:13:47 +0200244 ${HEADER_DIR}/internal/catch_wildcard_pattern.cpp
245 ${HEADER_DIR}/internal/catch_xmlwriter.cpp
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200246 )
247set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS})
248CheckFileList(INTERNAL_FILES ${HEADER_DIR}/internal)
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +0100249
250# Please keep these ordered alphabetically
251set(REPORTER_HEADERS
Justin Wilsonb753f052017-02-22 04:17:25 -0600252 ${HEADER_DIR}/reporters/catch_reporter_automake.hpp
Phil Nashe1fbbe12017-01-06 16:59:18 +0000253 ${HEADER_DIR}/reporters/catch_reporter_bases.hpp
Martin Hořeňovský4a1e8982017-07-19 10:13:47 +0200254 ${HEADER_DIR}/reporters/catch_reporter_multi.h
Martin Hořeňovskýb0260c62017-02-22 13:28:13 +0100255 ${HEADER_DIR}/reporters/catch_reporter_tap.hpp
Phil Nashe1fbbe12017-01-06 16:59:18 +0000256 ${HEADER_DIR}/reporters/catch_reporter_teamcity.hpp
Phil Nashe1fbbe12017-01-06 16:59:18 +0000257 )
Martin Hořeňovský5f3f19d2017-07-10 11:33:18 +0200258set(REPORTER_SOURCES
259 ${HEADER_DIR}/reporters/catch_reporter_bases.cpp
260 ${HEADER_DIR}/reporters/catch_reporter_compact.cpp
261 ${HEADER_DIR}/reporters/catch_reporter_console.cpp
262 ${HEADER_DIR}/reporters/catch_reporter_junit.cpp
263 ${HEADER_DIR}/reporters/catch_reporter_multi.cpp
264 ${HEADER_DIR}/reporters/catch_reporter_xml.cpp
265 )
266set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES})
267CheckFileList(REPORTER_FILES ${HEADER_DIR}/reporters)
Martin Hořeňovskýe6ef60a2017-01-15 22:07:36 +0100268
269# Specify the headers, too, so CLion recognises them as project files
270set(HEADERS
271 ${TOP_LEVEL_HEADERS}
272 ${EXTERNAL_HEADERS}
273 ${INTERNAL_HEADERS}
274 ${REPORTER_HEADERS}
275 )
276
Phil Nashe1fbbe12017-01-06 16:59:18 +0000277
Martin Hořeňovský3b7511e2017-01-14 21:55:37 +0100278set(BENCH_SOURCES
279 ${BENCHMARK_DIR}/BenchMain.cpp
280 ${BENCHMARK_DIR}/StringificationBench.cpp
281 )
Martin Hořeňovskýdab1d9d2017-01-25 23:02:25 +0100282CheckFileList(BENCH_SOURCES ${BENCHMARK_DIR})
283
Phil Nashd5360e82017-01-12 11:54:53 +0000284# Provide some groupings for IDEs
Phil Nash8abe17a2017-01-09 16:27:06 +0000285SOURCE_GROUP("Tests" FILES ${TEST_SOURCES})
Martin Hořeňovskýfc321652017-07-06 22:28:42 +0200286SOURCE_GROUP("Surrogates" FILES ${SURROGATE_SOURCES})
Martin Hořeňovský3b7511e2017-01-14 21:55:37 +0100287SOURCE_GROUP("Benchmarks" FILES ${BENCH_SOURCES})
Phil Nash8abe17a2017-01-09 16:27:06 +0000288
Kostace441a92013-08-05 12:40:33 +0200289# configure the executable
Phil Nashe1fbbe12017-01-06 16:59:18 +0000290include_directories(${HEADER_DIR})
Kostace441a92013-08-05 12:40:33 +0200291
Phil Nash78e79942017-06-29 11:18:14 +0100292add_definitions( -DCATCH_CONFIG_FULL_PROJECT )
293
Martin Hořeňovský9ceae8f2017-04-28 20:27:10 +0200294# Projects consuming Catch via ExternalProject_Add might want to use install step
295# without building all of our selftests.
296if (NOT NO_SELFTEST)
Martin Hořeňovský5f3f19d2017-07-10 11:33:18 +0200297 add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${REPORTER_SOURCES} ${SURROGATE_SOURCES} ${HEADERS})
298 add_executable(Benchmark ${BENCH_SOURCES} ${IMPL_SOURCES} ${REPORTER_SOURCES} ${HEADERS})
Martin Hořeňovský9ceae8f2017-04-28 20:27:10 +0200299
300 # Add desired warnings
301 if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
Martin Hořeňovský9aa96712017-09-07 16:51:33 +0200302 target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code )
303 target_compile_options( Benchmark PRIVATE -Wall -Wextra -Wunreachable-code )
304 endif()
305 # Clang specific warning go here
306 if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
307 # Actually keep these
308 target_compile_options( SelfTest PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn )
Martin Hořeňovský9ceae8f2017-04-28 20:27:10 +0200309 endif()
310 if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
311 target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX )
312 target_compile_options( Benchmark PRIVATE /W4 )
313 endif()
Martin Hořeňovský7ae96c72017-01-31 17:37:27 +0100314
315
Martin Hořeňovský9ceae8f2017-04-28 20:27:10 +0200316 # configure unit tests via CTest
317 enable_testing()
318 add_test(NAME RunTests COMMAND SelfTest)
Fraser Hutchison69a3f162013-10-24 02:57:46 +0100319
Martin Hořeňovský9ceae8f2017-04-28 20:27:10 +0200320 add_test(NAME ListTests COMMAND SelfTest --list-tests)
321 set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases")
Fraser Hutchison69a3f162013-10-24 02:57:46 +0100322
Martin Hořeňovský9ceae8f2017-04-28 20:27:10 +0200323 add_test(NAME ListTags COMMAND SelfTest --list-tags)
324 set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")
325
Martin Hořeňovskýab5d1762017-09-01 20:28:49 +0200326 # AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable
Martin Hořeňovskýb3a92312017-09-01 19:12:15 +0200327 add_test(NAME ApprovalTests COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
Martin Hořeňovský3a5b9512017-08-31 12:00:35 +0200328 set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed")
Martin Hořeňovský9ceae8f2017-04-28 20:27:10 +0200329endif() # !NO_SELFTEST
330
Saad K7dd4f292017-01-31 14:22:45 -0500331
Rian Quinn79ce6932017-03-22 14:19:51 -0600332install(DIRECTORY "single_include/" DESTINATION "include/catch")