Martin Hořeňovský | 50c95a0 | 2017-01-31 20:21:03 +0100 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 3.0) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 2 | |
Phil Nash | 0bcae64 | 2017-01-09 17:32:57 +0000 | [diff] [blame] | 3 | project(CatchSelfTest) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 4 | |
Martin Hořeňovský | a20b286 | 2017-11-05 12:46:04 +0100 | [diff] [blame] | 5 | option(USE_VALGRIND "Perform SelfTests with Valgrind" OFF) |
| 6 | |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 7 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
| 8 | |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 9 | # define some folders |
Phil Nash | c8fefc4 | 2017-01-06 16:19:20 +0000 | [diff] [blame] | 10 | set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 11 | set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest) |
Martin Hořeňovský | 3b7511e | 2017-01-14 21:55:37 +0100 | [diff] [blame] | 12 | set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark) |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 13 | set(HEADER_DIR ${CATCH_DIR}/include) |
Phil Nash | b119ebd | 2017-11-03 12:01:52 +0000 | [diff] [blame] | 14 | set(CATCH_VERSION_NUMBER 2.0.1) |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 15 | |
Antonio Di Monaco | b8443e6 | 2017-05-11 13:00:03 +0200 | [diff] [blame] | 16 | if(USE_WMAIN) |
| 17 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup") |
| 18 | endif() |
| 19 | |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 20 | #checks that the given hard-coded list contains all headers + sources in the given folder |
| 21 | function(CheckFileList LIST_VAR FOLDER) |
| 22 | set(MESSAGE " should be added to the variable ${LIST_VAR}") |
| 23 | set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n") |
| 24 | file(GLOB GLOBBED_LIST "${FOLDER}/*.cpp" |
| 25 | "${FOLDER}/*.hpp" |
| 26 | "${FOLDER}/*.h") |
| 27 | list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}}) |
| 28 | foreach(EXTRA_ITEM ${GLOBBED_LIST}) |
| 29 | string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}") |
| 30 | message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}") |
| 31 | endforeach() |
| 32 | endfunction() |
| 33 | |
| 34 | function(CheckFileListRec LIST_VAR FOLDER) |
| 35 | set(MESSAGE " should be added to the variable ${LIST_VAR}") |
| 36 | set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n") |
| 37 | file(GLOB_RECURSE GLOBBED_LIST "${FOLDER}/*.cpp" |
| 38 | "${FOLDER}/*.hpp" |
| 39 | "${FOLDER}/*.h") |
| 40 | list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}}) |
| 41 | foreach(EXTRA_ITEM ${GLOBBED_LIST}) |
| 42 | string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}") |
| 43 | message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}") |
| 44 | endforeach() |
| 45 | endfunction() |
| 46 | |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 47 | # define the sources of the self test |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 48 | # Please keep these ordered alphabetically |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 49 | set(TEST_SOURCES |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 50 | ${SELF_TEST_DIR}/ApproxTests.cpp |
| 51 | ${SELF_TEST_DIR}/BDDTests.cpp |
Phil Nash | f45d35c | 2017-08-05 11:12:29 +0100 | [diff] [blame] | 52 | ${SELF_TEST_DIR}/Benchmark.tests.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 53 | ${SELF_TEST_DIR}/ClassTests.cpp |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 54 | ${SELF_TEST_DIR}/CmdLineTests.cpp |
Martin Hořeňovský | 7db4d8d | 2017-02-07 13:32:48 +0100 | [diff] [blame] | 55 | ${SELF_TEST_DIR}/CompilationTests.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 56 | ${SELF_TEST_DIR}/ConditionTests.cpp |
Martin Hořeňovský | ea48ae0 | 2017-05-27 14:42:05 +0200 | [diff] [blame] | 57 | ${SELF_TEST_DIR}/DecompositionTests.cpp |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 58 | ${SELF_TEST_DIR}/EnumToString.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 59 | ${SELF_TEST_DIR}/ExceptionTests.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 60 | ${SELF_TEST_DIR}/MessageTests.cpp |
| 61 | ${SELF_TEST_DIR}/MiscTests.cpp |
| 62 | ${SELF_TEST_DIR}/PartTrackerTests.cpp |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 63 | ${SELF_TEST_DIR}/TagAliasTests.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 64 | ${SELF_TEST_DIR}/TestMain.cpp |
Martin Hořeňovský | 79b405f | 2017-10-09 12:31:22 +0200 | [diff] [blame] | 65 | ${SELF_TEST_DIR}/ToStringChrono.cpp |
Martin Hořeňovský | 7db4d8d | 2017-02-07 13:32:48 +0100 | [diff] [blame] | 66 | ${SELF_TEST_DIR}/ToStringGeneralTests.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 67 | ${SELF_TEST_DIR}/ToStringPair.cpp |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 68 | ${SELF_TEST_DIR}/ToStringTuple.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 69 | ${SELF_TEST_DIR}/ToStringVector.cpp |
| 70 | ${SELF_TEST_DIR}/ToStringWhich.cpp |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 71 | ${SELF_TEST_DIR}/TrickyTests.cpp |
| 72 | ${SELF_TEST_DIR}/VariadicMacrosTests.cpp |
Phil Nash | 4e6938d | 2017-02-21 14:19:09 +0000 | [diff] [blame] | 73 | ${SELF_TEST_DIR}/MatchersTests.cpp |
Phil Nash | 78e7994 | 2017-06-29 11:18:14 +0100 | [diff] [blame] | 74 | ${SELF_TEST_DIR}/StringRef.tests.cpp |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 75 | ) |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 76 | CheckFileList(TEST_SOURCES ${SELF_TEST_DIR}) |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 77 | |
| 78 | # A set of impl files that just #include a single header |
| 79 | # Please keep these ordered alphabetically |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 80 | set(SURROGATE_SOURCES |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 81 | ${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp |
| 82 | ${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 83 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 84 | ${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 85 | ${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp |
Phil Nash | f45d35c | 2017-08-05 11:12:29 +0100 | [diff] [blame] | 86 | ${SELF_TEST_DIR}/SurrogateCpps/catch_test_case_tracker.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 87 | ${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp |
| 88 | ${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp |
| 89 | ) |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 90 | CheckFileList(SURROGATE_SOURCES ${SELF_TEST_DIR}/SurrogateCpps) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 91 | |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 92 | |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 93 | # Please keep these ordered alphabetically |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 94 | set(TOP_LEVEL_HEADERS |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 95 | ${HEADER_DIR}/catch.hpp |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 96 | ${HEADER_DIR}/catch_with_main.hpp |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 97 | ) |
| 98 | CheckFileList(TOP_LEVEL_HEADERS ${HEADER_DIR}) |
Martin Hořeňovský | dab1d9d | 2017-01-25 23:02:25 +0100 | [diff] [blame] | 99 | |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 100 | # Please keep these ordered alphabetically |
| 101 | set(EXTERNAL_HEADERS |
Phil Nash | 1c223b6 | 2017-06-12 23:04:24 +0100 | [diff] [blame] | 102 | ${HEADER_DIR}/external/clara.hpp |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 103 | ) |
| 104 | CheckFileList(EXTERNAL_HEADERS ${HEADER_DIR}/external) |
| 105 | |
Martin Hořeňovský | dab1d9d | 2017-01-25 23:02:25 +0100 | [diff] [blame] | 106 | |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 107 | # Please keep these ordered alphabetically |
| 108 | set(INTERNAL_HEADERS |
Phil Nash | ca7021a | 2017-09-07 12:58:44 +0100 | [diff] [blame] | 109 | ${HEADER_DIR}/internal/catch_approx.h |
Phil Nash | f247ce5 | 2017-08-08 17:53:01 +0100 | [diff] [blame] | 110 | ${HEADER_DIR}/internal/catch_assertionhandler.h |
| 111 | ${HEADER_DIR}/internal/catch_assertioninfo.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 112 | ${HEADER_DIR}/internal/catch_assertionresult.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 113 | ${HEADER_DIR}/internal/catch_capture.hpp |
Phil Nash | ee9b19e | 2017-08-09 12:10:14 +0100 | [diff] [blame] | 114 | ${HEADER_DIR}/internal/catch_capture_matchers.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 115 | ${HEADER_DIR}/internal/catch_clara.h |
Phil Nash | ca7021a | 2017-09-07 12:58:44 +0100 | [diff] [blame] | 116 | ${HEADER_DIR}/internal/catch_commandline.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 117 | ${HEADER_DIR}/internal/catch_common.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 118 | ${HEADER_DIR}/internal/catch_compiler_capabilities.h |
| 119 | ${HEADER_DIR}/internal/catch_config.hpp |
Phil Nash | ca7021a | 2017-09-07 12:58:44 +0100 | [diff] [blame] | 120 | ${HEADER_DIR}/internal/catch_console_colour.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 121 | ${HEADER_DIR}/internal/catch_context.h |
Martin Hořeňovský | 5932576 | 2017-08-29 13:51:55 +0200 | [diff] [blame] | 122 | ${HEADER_DIR}/internal/catch_debug_console.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 123 | ${HEADER_DIR}/internal/catch_debugger.h |
Phil Nash | f247ce5 | 2017-08-08 17:53:01 +0100 | [diff] [blame] | 124 | ${HEADER_DIR}/internal/catch_decomposer.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 125 | ${HEADER_DIR}/internal/catch_default_main.hpp |
Martin Hořeňovský | feca97d | 2017-08-01 18:46:33 +0200 | [diff] [blame] | 126 | ${HEADER_DIR}/internal/catch_enforce.h |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 127 | ${HEADER_DIR}/internal/catch_errno_guard.h |
Martin Hořeňovský | 1d3bfa0 | 2017-07-10 14:25:38 +0200 | [diff] [blame] | 128 | ${HEADER_DIR}/internal/catch_exception_translator_registry.h |
Martin Hořeňovský | 24af32f | 2017-08-17 20:21:06 +0200 | [diff] [blame] | 129 | ${HEADER_DIR}/internal/catch_external_interfaces.h |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 130 | ${HEADER_DIR}/internal/catch_fatal_condition.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 131 | ${HEADER_DIR}/internal/catch_impl.hpp |
| 132 | ${HEADER_DIR}/internal/catch_interfaces_capture.h |
| 133 | ${HEADER_DIR}/internal/catch_interfaces_config.h |
| 134 | ${HEADER_DIR}/internal/catch_interfaces_exception.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 135 | ${HEADER_DIR}/internal/catch_interfaces_registry_hub.h |
| 136 | ${HEADER_DIR}/internal/catch_interfaces_reporter.h |
| 137 | ${HEADER_DIR}/internal/catch_interfaces_runner.h |
| 138 | ${HEADER_DIR}/internal/catch_interfaces_tag_alias_registry.h |
| 139 | ${HEADER_DIR}/internal/catch_interfaces_testcase.h |
Martin Hořeňovský | 4332b84 | 2017-07-12 14:47:36 +0200 | [diff] [blame] | 140 | ${HEADER_DIR}/internal/catch_leak_detector.h |
Martin Hořeňovský | 1d3bfa0 | 2017-07-10 14:25:38 +0200 | [diff] [blame] | 141 | ${HEADER_DIR}/internal/catch_list.h |
Phil Nash | ca7021a | 2017-09-07 12:58:44 +0100 | [diff] [blame] | 142 | ${HEADER_DIR}/internal/catch_matchers.h |
Martin Hořeňovský | 0b1f1b1 | 2017-11-10 18:14:42 +0100 | [diff] [blame] | 143 | ${HEADER_DIR}/internal/catch_matchers_floating.h |
Phil Nash | 1400127 | 2017-02-08 15:14:51 +0000 | [diff] [blame] | 144 | ${HEADER_DIR}/internal/catch_matchers_string.h |
Phil Nash | 10dfca3 | 2017-02-21 16:05:04 +0000 | [diff] [blame] | 145 | ${HEADER_DIR}/internal/catch_matchers_vector.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 146 | ${HEADER_DIR}/internal/catch_message.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 147 | ${HEADER_DIR}/internal/catch_objc.hpp |
| 148 | ${HEADER_DIR}/internal/catch_objc_arc.hpp |
| 149 | ${HEADER_DIR}/internal/catch_option.hpp |
| 150 | ${HEADER_DIR}/internal/catch_platform.h |
Martin Hořeňovský | 0673b9b | 2017-08-30 15:32:44 +0200 | [diff] [blame] | 151 | ${HEADER_DIR}/internal/catch_random_number_generator.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 152 | ${HEADER_DIR}/internal/catch_reenable_warnings.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 153 | ${HEADER_DIR}/internal/catch_reporter_registrars.hpp |
Martin Hořeňovský | 9aa9671 | 2017-09-07 16:51:33 +0200 | [diff] [blame] | 154 | ${HEADER_DIR}/internal/catch_reporter_registry.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 155 | ${HEADER_DIR}/internal/catch_result_type.h |
Phil Nash | ca7021a | 2017-09-07 12:58:44 +0100 | [diff] [blame] | 156 | ${HEADER_DIR}/internal/catch_run_context.h |
Phil Nash | a9b6813 | 2017-08-04 19:23:30 +0100 | [diff] [blame] | 157 | ${HEADER_DIR}/internal/catch_benchmark.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 158 | ${HEADER_DIR}/internal/catch_section.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 159 | ${HEADER_DIR}/internal/catch_section_info.h |
Martin Hořeňovský | e871742 | 2017-08-31 10:31:52 +0200 | [diff] [blame] | 160 | ${HEADER_DIR}/internal/catch_session.h |
Martin Hořeňovský | da0edcb | 2017-06-04 21:39:27 +0200 | [diff] [blame] | 161 | ${HEADER_DIR}/internal/catch_startup_exception_registry.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 162 | ${HEADER_DIR}/internal/catch_stream.h |
Phil Nash | 78e7994 | 2017-06-29 11:18:14 +0100 | [diff] [blame] | 163 | ${HEADER_DIR}/internal/catch_stringref.h |
Martin Hořeňovský | 1a96175 | 2017-07-25 21:57:35 +0200 | [diff] [blame] | 164 | ${HEADER_DIR}/internal/catch_string_manip.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 165 | ${HEADER_DIR}/internal/catch_suppress_warnings.h |
| 166 | ${HEADER_DIR}/internal/catch_tag_alias.h |
Martin Hořeňovský | 33fd54a | 2017-07-27 11:55:30 +0200 | [diff] [blame] | 167 | ${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 168 | ${HEADER_DIR}/internal/catch_tag_alias_registry.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 169 | ${HEADER_DIR}/internal/catch_test_case_info.h |
Phil Nash | ca7021a | 2017-09-07 12:58:44 +0100 | [diff] [blame] | 170 | ${HEADER_DIR}/internal/catch_test_case_registry_impl.h |
| 171 | ${HEADER_DIR}/internal/catch_test_case_tracker.h |
| 172 | ${HEADER_DIR}/internal/catch_test_registry.h |
| 173 | ${HEADER_DIR}/internal/catch_test_spec.h |
| 174 | ${HEADER_DIR}/internal/catch_test_spec_parser.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 175 | ${HEADER_DIR}/internal/catch_text.h |
| 176 | ${HEADER_DIR}/internal/catch_timer.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 177 | ${HEADER_DIR}/internal/catch_tostring.h |
Phil Nash | ca7021a | 2017-09-07 12:58:44 +0100 | [diff] [blame] | 178 | ${HEADER_DIR}/internal/catch_totals.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 179 | ${HEADER_DIR}/internal/catch_version.h |
Phil Nash | ca7021a | 2017-09-07 12:58:44 +0100 | [diff] [blame] | 180 | ${HEADER_DIR}/internal/catch_wildcard_pattern.h |
Martin Hořeňovský | 531d267 | 2017-01-16 19:56:57 +0100 | [diff] [blame] | 181 | ${HEADER_DIR}/internal/catch_windows_h_proxy.h |
Phil Nash | ca7021a | 2017-09-07 12:58:44 +0100 | [diff] [blame] | 182 | ${HEADER_DIR}/internal/catch_xmlwriter.h |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 183 | ) |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 184 | set(IMPL_SOURCES |
Martin Hořeňovský | edbe122 | 2017-07-19 10:01:06 +0200 | [diff] [blame] | 185 | ${HEADER_DIR}/internal/catch_approx.cpp |
Phil Nash | f247ce5 | 2017-08-08 17:53:01 +0100 | [diff] [blame] | 186 | ${HEADER_DIR}/internal/catch_assertionhandler.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 187 | ${HEADER_DIR}/internal/catch_assertionresult.cpp |
Phil Nash | a9b6813 | 2017-08-04 19:23:30 +0100 | [diff] [blame] | 188 | ${HEADER_DIR}/internal/catch_benchmark.cpp |
Phil Nash | ee9b19e | 2017-08-09 12:10:14 +0100 | [diff] [blame] | 189 | ${HEADER_DIR}/internal/catch_capture_matchers.cpp |
Martin Hořeňovský | 1d3bfa0 | 2017-07-10 14:25:38 +0200 | [diff] [blame] | 190 | ${HEADER_DIR}/internal/catch_commandline.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 191 | ${HEADER_DIR}/internal/catch_common.cpp |
Martin Hořeňovský | 4a1e898 | 2017-07-19 10:13:47 +0200 | [diff] [blame] | 192 | ${HEADER_DIR}/internal/catch_config.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 193 | ${HEADER_DIR}/internal/catch_console_colour.cpp |
| 194 | ${HEADER_DIR}/internal/catch_context.cpp |
Martin Hořeňovský | 5932576 | 2017-08-29 13:51:55 +0200 | [diff] [blame] | 195 | ${HEADER_DIR}/internal/catch_debug_console.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 196 | ${HEADER_DIR}/internal/catch_debugger.cpp |
Phil Nash | f247ce5 | 2017-08-08 17:53:01 +0100 | [diff] [blame] | 197 | ${HEADER_DIR}/internal/catch_decomposer.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 198 | ${HEADER_DIR}/internal/catch_errno_guard.cpp |
Martin Hořeňovský | 1d3bfa0 | 2017-07-10 14:25:38 +0200 | [diff] [blame] | 199 | ${HEADER_DIR}/internal/catch_exception_translator_registry.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 200 | ${HEADER_DIR}/internal/catch_fatal_condition.cpp |
Martin Hořeňovský | 9aa9671 | 2017-09-07 16:51:33 +0200 | [diff] [blame] | 201 | ${HEADER_DIR}/internal/catch_interfaces_capture.cpp |
| 202 | ${HEADER_DIR}/internal/catch_interfaces_config.cpp |
| 203 | ${HEADER_DIR}/internal/catch_interfaces_exception.cpp |
| 204 | ${HEADER_DIR}/internal/catch_interfaces_registry_hub.cpp |
| 205 | ${HEADER_DIR}/internal/catch_interfaces_runner.cpp |
| 206 | ${HEADER_DIR}/internal/catch_interfaces_testcase.cpp |
Martin Hořeňovský | 1d3bfa0 | 2017-07-10 14:25:38 +0200 | [diff] [blame] | 207 | ${HEADER_DIR}/internal/catch_list.cpp |
Martin Hořeňovský | 4332b84 | 2017-07-12 14:47:36 +0200 | [diff] [blame] | 208 | ${HEADER_DIR}/internal/catch_leak_detector.cpp |
Martin Hořeňovský | 87a66b8 | 2017-07-20 00:27:28 +0200 | [diff] [blame] | 209 | ${HEADER_DIR}/internal/catch_matchers.cpp |
Martin Hořeňovský | 0b1f1b1 | 2017-11-10 18:14:42 +0100 | [diff] [blame] | 210 | ${HEADER_DIR}/internal/catch_matchers_floating.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 211 | ${HEADER_DIR}/internal/catch_matchers_string.cpp |
| 212 | ${HEADER_DIR}/internal/catch_message.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 213 | ${HEADER_DIR}/internal/catch_registry_hub.cpp |
Martin Hořeňovský | 4a1e898 | 2017-07-19 10:13:47 +0200 | [diff] [blame] | 214 | ${HEADER_DIR}/internal/catch_interfaces_reporter.cpp |
Martin Hořeňovský | 0673b9b | 2017-08-30 15:32:44 +0200 | [diff] [blame] | 215 | ${HEADER_DIR}/internal/catch_random_number_generator.cpp |
Martin Hořeňovský | 9aa9671 | 2017-09-07 16:51:33 +0200 | [diff] [blame] | 216 | ${HEADER_DIR}/internal/catch_reporter_registry.cpp |
Martin Hořeňovský | 8d8f481 | 2017-07-12 16:07:10 +0200 | [diff] [blame] | 217 | ${HEADER_DIR}/internal/catch_result_type.cpp |
Martin Hořeňovský | 7ccf11d | 2017-07-15 16:48:21 +0200 | [diff] [blame] | 218 | ${HEADER_DIR}/internal/catch_run_context.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 219 | ${HEADER_DIR}/internal/catch_section.cpp |
Martin Hořeňovský | d4e796c | 2017-08-01 17:51:32 +0200 | [diff] [blame] | 220 | ${HEADER_DIR}/internal/catch_section_info.cpp |
Martin Hořeňovský | e871742 | 2017-08-31 10:31:52 +0200 | [diff] [blame] | 221 | ${HEADER_DIR}/internal/catch_session.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 222 | ${HEADER_DIR}/internal/catch_startup_exception_registry.cpp |
Martin Hořeňovský | 11295a2 | 2017-08-10 11:45:05 +0200 | [diff] [blame] | 223 | ${HEADER_DIR}/internal/catch_stream.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 224 | ${HEADER_DIR}/internal/catch_stringref.cpp |
Martin Hořeňovský | 1a96175 | 2017-07-25 21:57:35 +0200 | [diff] [blame] | 225 | ${HEADER_DIR}/internal/catch_string_manip.cpp |
Martin Hořeňovský | 9de729b | 2017-07-25 22:13:14 +0200 | [diff] [blame] | 226 | ${HEADER_DIR}/internal/catch_tag_alias.cpp |
Martin Hořeňovský | 33fd54a | 2017-07-27 11:55:30 +0200 | [diff] [blame] | 227 | ${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 228 | ${HEADER_DIR}/internal/catch_tag_alias_registry.cpp |
| 229 | ${HEADER_DIR}/internal/catch_test_case_info.cpp |
Martin Hořeňovský | a75eaa3 | 2017-07-25 22:41:35 +0200 | [diff] [blame] | 230 | ${HEADER_DIR}/internal/catch_test_case_registry_impl.cpp |
Martin Hořeňovský | 4a1e898 | 2017-07-19 10:13:47 +0200 | [diff] [blame] | 231 | ${HEADER_DIR}/internal/catch_test_case_tracker.cpp |
Martin Hořeňovský | a75eaa3 | 2017-07-25 22:41:35 +0200 | [diff] [blame] | 232 | ${HEADER_DIR}/internal/catch_test_registry.cpp |
Martin Hořeňovský | 4a1e898 | 2017-07-19 10:13:47 +0200 | [diff] [blame] | 233 | ${HEADER_DIR}/internal/catch_test_spec.cpp |
| 234 | ${HEADER_DIR}/internal/catch_test_spec_parser.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 235 | ${HEADER_DIR}/internal/catch_timer.cpp |
| 236 | ${HEADER_DIR}/internal/catch_tostring.cpp |
Martin Hořeňovský | 4a1e898 | 2017-07-19 10:13:47 +0200 | [diff] [blame] | 237 | ${HEADER_DIR}/internal/catch_totals.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 238 | ${HEADER_DIR}/internal/catch_version.cpp |
Martin Hořeňovský | 4a1e898 | 2017-07-19 10:13:47 +0200 | [diff] [blame] | 239 | ${HEADER_DIR}/internal/catch_wildcard_pattern.cpp |
| 240 | ${HEADER_DIR}/internal/catch_xmlwriter.cpp |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 241 | ) |
| 242 | set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS}) |
| 243 | CheckFileList(INTERNAL_FILES ${HEADER_DIR}/internal) |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 244 | |
| 245 | # Please keep these ordered alphabetically |
| 246 | set(REPORTER_HEADERS |
Justin Wilson | b753f05 | 2017-02-22 04:17:25 -0600 | [diff] [blame] | 247 | ${HEADER_DIR}/reporters/catch_reporter_automake.hpp |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 248 | ${HEADER_DIR}/reporters/catch_reporter_bases.hpp |
Martin Hořeňovský | 4a1e898 | 2017-07-19 10:13:47 +0200 | [diff] [blame] | 249 | ${HEADER_DIR}/reporters/catch_reporter_multi.h |
Martin Hořeňovský | b0260c6 | 2017-02-22 13:28:13 +0100 | [diff] [blame] | 250 | ${HEADER_DIR}/reporters/catch_reporter_tap.hpp |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 251 | ${HEADER_DIR}/reporters/catch_reporter_teamcity.hpp |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 252 | ) |
Martin Hořeňovský | 5f3f19d | 2017-07-10 11:33:18 +0200 | [diff] [blame] | 253 | set(REPORTER_SOURCES |
| 254 | ${HEADER_DIR}/reporters/catch_reporter_bases.cpp |
| 255 | ${HEADER_DIR}/reporters/catch_reporter_compact.cpp |
| 256 | ${HEADER_DIR}/reporters/catch_reporter_console.cpp |
| 257 | ${HEADER_DIR}/reporters/catch_reporter_junit.cpp |
| 258 | ${HEADER_DIR}/reporters/catch_reporter_multi.cpp |
| 259 | ${HEADER_DIR}/reporters/catch_reporter_xml.cpp |
| 260 | ) |
| 261 | set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES}) |
| 262 | CheckFileList(REPORTER_FILES ${HEADER_DIR}/reporters) |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 263 | |
| 264 | # Specify the headers, too, so CLion recognises them as project files |
| 265 | set(HEADERS |
| 266 | ${TOP_LEVEL_HEADERS} |
| 267 | ${EXTERNAL_HEADERS} |
| 268 | ${INTERNAL_HEADERS} |
| 269 | ${REPORTER_HEADERS} |
| 270 | ) |
| 271 | |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 272 | # Provide some groupings for IDEs |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 273 | SOURCE_GROUP("Tests" FILES ${TEST_SOURCES}) |
Martin Hořeňovský | fc32165 | 2017-07-06 22:28:42 +0200 | [diff] [blame] | 274 | SOURCE_GROUP("Surrogates" FILES ${SURROGATE_SOURCES}) |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 275 | |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 276 | # configure the executable |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 277 | |
Martin Hořeňovský | 9ceae8f | 2017-04-28 20:27:10 +0200 | [diff] [blame] | 278 | # Projects consuming Catch via ExternalProject_Add might want to use install step |
| 279 | # without building all of our selftests. |
| 280 | if (NOT NO_SELFTEST) |
Martin Hořeňovský | 5f3f19d | 2017-07-10 11:33:18 +0200 | [diff] [blame] | 281 | add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${REPORTER_SOURCES} ${SURROGATE_SOURCES} ${HEADERS}) |
Martin Moene | fa9c420 | 2017-11-04 19:19:48 +0100 | [diff] [blame] | 282 | target_include_directories(SelfTest PRIVATE ${HEADER_DIR}) |
Martin Hořeňovský | 9ceae8f | 2017-04-28 20:27:10 +0200 | [diff] [blame] | 283 | |
Martin Hořeňovský | 7a562d3 | 2017-11-05 13:11:00 +0100 | [diff] [blame] | 284 | if(USE_CPP14) |
| 285 | message(STATUS "Enabling C++14") |
| 286 | set_property(TARGET SelfTest PROPERTY CXX_STANDARD 14) |
| 287 | else() |
| 288 | message(STATUS "Enabling C++11") |
| 289 | set_property(TARGET SelfTest PROPERTY CXX_STANDARD 11) |
| 290 | endif() |
| 291 | |
| 292 | set_property(TARGET SelfTest PROPERTY CXX_STANDARD_REQUIRED ON) |
| 293 | set_property(TARGET SelfTest PROPERTY CXX_EXTENSIONS OFF) |
| 294 | |
| 295 | |
Martin Hořeňovský | 9ceae8f | 2017-04-28 20:27:10 +0200 | [diff] [blame] | 296 | # Add desired warnings |
| 297 | if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" ) |
Martin Hořeňovský | 9aa9671 | 2017-09-07 16:51:33 +0200 | [diff] [blame] | 298 | target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code ) |
Martin Hořeňovský | 9aa9671 | 2017-09-07 16:51:33 +0200 | [diff] [blame] | 299 | endif() |
| 300 | # Clang specific warning go here |
| 301 | if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) |
| 302 | # Actually keep these |
| 303 | target_compile_options( SelfTest PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn ) |
Martin Hořeňovský | 9ceae8f | 2017-04-28 20:27:10 +0200 | [diff] [blame] | 304 | endif() |
| 305 | if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) |
Martin Hořeňovský | c672512 | 2017-10-30 12:14:20 +0100 | [diff] [blame] | 306 | target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX /w44061 /w44062 ) |
Martin Hořeňovský | 9ceae8f | 2017-04-28 20:27:10 +0200 | [diff] [blame] | 307 | endif() |
Martin Hořeňovský | 7ae96c7 | 2017-01-31 17:37:27 +0100 | [diff] [blame] | 308 | |
| 309 | |
Martin Hořeňovský | 9ceae8f | 2017-04-28 20:27:10 +0200 | [diff] [blame] | 310 | # configure unit tests via CTest |
| 311 | enable_testing() |
Martin Hořeňovský | a20b286 | 2017-11-05 12:46:04 +0100 | [diff] [blame] | 312 | add_test(NAME RunTests COMMAND $<TARGET_FILE:SelfTest>) |
Fraser Hutchison | 69a3f16 | 2013-10-24 02:57:46 +0100 | [diff] [blame] | 313 | |
Martin Hořeňovský | a20b286 | 2017-11-05 12:46:04 +0100 | [diff] [blame] | 314 | add_test(NAME ListTests COMMAND $<TARGET_FILE:SelfTest> --list-tests) |
Martin Hořeňovský | 9ceae8f | 2017-04-28 20:27:10 +0200 | [diff] [blame] | 315 | set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") |
Fraser Hutchison | 69a3f16 | 2013-10-24 02:57:46 +0100 | [diff] [blame] | 316 | |
Martin Hořeňovský | a20b286 | 2017-11-05 12:46:04 +0100 | [diff] [blame] | 317 | add_test(NAME ListTags COMMAND $<TARGET_FILE:SelfTest> --list-tags) |
Martin Hořeňovský | 9ceae8f | 2017-04-28 20:27:10 +0200 | [diff] [blame] | 318 | set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") |
| 319 | |
Martin Hořeňovský | ab5d176 | 2017-09-01 20:28:49 +0200 | [diff] [blame] | 320 | # AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable |
Martin Hořeňovský | b3a9231 | 2017-09-01 19:12:15 +0200 | [diff] [blame] | 321 | add_test(NAME ApprovalTests COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>) |
Martin Hořeňovský | 3a5b951 | 2017-08-31 12:00:35 +0200 | [diff] [blame] | 322 | set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed") |
Martin Hořeňovský | a20b286 | 2017-11-05 12:46:04 +0100 | [diff] [blame] | 323 | |
| 324 | if (USE_VALGRIND) |
| 325 | add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>) |
| 326 | add_test(NAME ValgrindListTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tests) |
| 327 | set_tests_properties(ValgrindListTests PROPERTIES PASS_REGULAR_EXPRESSION "definitely lost: 0 bytes in 0 blocks") |
| 328 | add_test(NAME ValgrindListTags COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tags) |
| 329 | set_tests_properties(ValgrindListTags PROPERTIES PASS_REGULAR_EXPRESSION "definitely lost: 0 bytes in 0 blocks") |
| 330 | endif() |
| 331 | |
Martin Hořeňovský | 9ceae8f | 2017-04-28 20:27:10 +0200 | [diff] [blame] | 332 | endif() # !NO_SELFTEST |
| 333 | |
Saad K | 7dd4f29 | 2017-01-31 14:22:45 -0500 | [diff] [blame] | 334 | |
Rian Quinn | 79ce693 | 2017-03-22 14:19:51 -0600 | [diff] [blame] | 335 | install(DIRECTORY "single_include/" DESTINATION "include/catch") |
Martin Hořeňovský | c7d9f02 | 2017-10-12 21:42:09 +0200 | [diff] [blame] | 336 | |
| 337 | ## Provide some pkg-config integration |
| 338 | # Don't bother on Windows |
| 339 | if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows) |
| 340 | |
| 341 | set(PKGCONFIG_INSTALL_DIR |
| 342 | "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" |
| 343 | CACHE PATH "Path where catch.pc is installed" |
| 344 | ) |
| 345 | |
| 346 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/catch.pc.in ${CMAKE_CURRENT_BINARY_DIR}/catch.pc @ONLY) |
| 347 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catch.pc DESTINATION ${PKGCONFIG_INSTALL_DIR}) |
| 348 | |
| 349 | endif() |