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 | |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 5 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
| 6 | |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 7 | # define some folders |
Phil Nash | c8fefc4 | 2017-01-06 16:19:20 +0000 | [diff] [blame] | 8 | set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 9 | set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest) |
Martin Hořeňovský | 3b7511e | 2017-01-14 21:55:37 +0100 | [diff] [blame] | 10 | set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark) |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 11 | set(HEADER_DIR ${CATCH_DIR}/include) |
| 12 | |
Andy Sawyer | 13cbdf7 | 2014-09-04 00:32:05 +0100 | [diff] [blame] | 13 | if(USE_CPP11) |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 14 | ## We can't turn this on by default, since it breaks on travis |
| 15 | message(STATUS "Enabling C++11") |
| 16 | set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 17 | elseif(USE_CPP14) |
| 18 | message(STATUS "Enabling C++14") |
| 19 | set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}") |
Andy Sawyer | 13cbdf7 | 2014-09-04 00:32:05 +0100 | [diff] [blame] | 20 | endif() |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 21 | |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 22 | #checks that the given hard-coded list contains all headers + sources in the given folder |
| 23 | function(CheckFileList LIST_VAR FOLDER) |
| 24 | set(MESSAGE " should be added to the variable ${LIST_VAR}") |
| 25 | set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n") |
| 26 | file(GLOB GLOBBED_LIST "${FOLDER}/*.cpp" |
| 27 | "${FOLDER}/*.hpp" |
| 28 | "${FOLDER}/*.h") |
| 29 | list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}}) |
| 30 | foreach(EXTRA_ITEM ${GLOBBED_LIST}) |
| 31 | string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}") |
| 32 | message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}") |
| 33 | endforeach() |
| 34 | endfunction() |
| 35 | |
| 36 | function(CheckFileListRec LIST_VAR FOLDER) |
| 37 | set(MESSAGE " should be added to the variable ${LIST_VAR}") |
| 38 | set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n") |
| 39 | file(GLOB_RECURSE GLOBBED_LIST "${FOLDER}/*.cpp" |
| 40 | "${FOLDER}/*.hpp" |
| 41 | "${FOLDER}/*.h") |
| 42 | list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}}) |
| 43 | foreach(EXTRA_ITEM ${GLOBBED_LIST}) |
| 44 | string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}") |
| 45 | message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}") |
| 46 | endforeach() |
| 47 | endfunction() |
| 48 | |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 49 | # define the sources of the self test |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 50 | # Please keep these ordered alphabetically |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 51 | set(TEST_SOURCES |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 52 | ${SELF_TEST_DIR}/ApproxTests.cpp |
| 53 | ${SELF_TEST_DIR}/BDDTests.cpp |
| 54 | ${SELF_TEST_DIR}/ClassTests.cpp |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 55 | ${SELF_TEST_DIR}/CmdLineTests.cpp |
Martin Hořeňovský | 7db4d8d | 2017-02-07 13:32:48 +0100 | [diff] [blame] | 56 | ${SELF_TEST_DIR}/CompilationTests.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 57 | ${SELF_TEST_DIR}/ConditionTests.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 |
| 60 | ${SELF_TEST_DIR}/GeneratorTests.cpp |
| 61 | ${SELF_TEST_DIR}/MessageTests.cpp |
| 62 | ${SELF_TEST_DIR}/MiscTests.cpp |
| 63 | ${SELF_TEST_DIR}/PartTrackerTests.cpp |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 64 | ${SELF_TEST_DIR}/TagAliasTests.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 65 | ${SELF_TEST_DIR}/TestMain.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 | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 74 | ) |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 75 | CheckFileList(TEST_SOURCES ${SELF_TEST_DIR}) |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 76 | |
| 77 | # A set of impl files that just #include a single header |
| 78 | # Please keep these ordered alphabetically |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 79 | set(IMPL_SOURCES |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 80 | ${SELF_TEST_DIR}/SurrogateCpps/catch_common.cpp |
| 81 | ${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp |
| 82 | ${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp |
| 83 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_capture.cpp |
| 84 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_config.cpp |
| 85 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_exception.cpp |
| 86 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_generators.cpp |
| 87 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_registry_hub.cpp |
| 88 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp |
| 89 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_runner.cpp |
| 90 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_testcase.cpp |
| 91 | ${SELF_TEST_DIR}/SurrogateCpps/catch_message.cpp |
| 92 | ${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp |
| 93 | ${SELF_TEST_DIR}/SurrogateCpps/catch_ptr.cpp |
| 94 | ${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp |
| 95 | ${SELF_TEST_DIR}/SurrogateCpps/catch_streambuf.cpp |
| 96 | ${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp |
| 97 | ${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp |
Phil Nash | 876af87 | 2017-01-23 15:18:23 +0000 | [diff] [blame] | 98 | ${SELF_TEST_DIR}/SurrogateCpps/catch_test_case_tracker.cpp |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 99 | ) |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 100 | CheckFileList(IMPL_SOURCES ${SELF_TEST_DIR}/SurrogateCpps) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 101 | |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 102 | |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 103 | # Please keep these ordered alphabetically |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 104 | set(TOP_LEVEL_HEADERS |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 105 | ${HEADER_DIR}/catch.hpp |
| 106 | ${HEADER_DIR}/catch_session.hpp |
| 107 | ${HEADER_DIR}/catch_with_main.hpp |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 108 | ) |
| 109 | CheckFileList(TOP_LEVEL_HEADERS ${HEADER_DIR}) |
Martin Hořeňovský | dab1d9d | 2017-01-25 23:02:25 +0100 | [diff] [blame] | 110 | |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 111 | # Please keep these ordered alphabetically |
| 112 | set(EXTERNAL_HEADERS |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 113 | ${HEADER_DIR}/external/clara.h |
| 114 | ${HEADER_DIR}/external/tbc_text_format.h |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 115 | ) |
| 116 | CheckFileList(EXTERNAL_HEADERS ${HEADER_DIR}/external) |
| 117 | |
Martin Hořeňovský | dab1d9d | 2017-01-25 23:02:25 +0100 | [diff] [blame] | 118 | |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 119 | # Please keep these ordered alphabetically |
| 120 | set(INTERNAL_HEADERS |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 121 | ${HEADER_DIR}/internal/catch_approx.hpp |
| 122 | ${HEADER_DIR}/internal/catch_assertionresult.h |
| 123 | ${HEADER_DIR}/internal/catch_assertionresult.hpp |
| 124 | ${HEADER_DIR}/internal/catch_capture.hpp |
| 125 | ${HEADER_DIR}/internal/catch_clara.h |
| 126 | ${HEADER_DIR}/internal/catch_commandline.hpp |
| 127 | ${HEADER_DIR}/internal/catch_common.h |
| 128 | ${HEADER_DIR}/internal/catch_common.hpp |
| 129 | ${HEADER_DIR}/internal/catch_compiler_capabilities.h |
| 130 | ${HEADER_DIR}/internal/catch_config.hpp |
| 131 | ${HEADER_DIR}/internal/catch_console_colour.hpp |
| 132 | ${HEADER_DIR}/internal/catch_console_colour_impl.hpp |
| 133 | ${HEADER_DIR}/internal/catch_context.h |
| 134 | ${HEADER_DIR}/internal/catch_context_impl.hpp |
| 135 | ${HEADER_DIR}/internal/catch_debugger.h |
| 136 | ${HEADER_DIR}/internal/catch_debugger.hpp |
| 137 | ${HEADER_DIR}/internal/catch_default_main.hpp |
| 138 | ${HEADER_DIR}/internal/catch_evaluate.hpp |
| 139 | ${HEADER_DIR}/internal/catch_exception_translator_registry.hpp |
| 140 | ${HEADER_DIR}/internal/catch_expression_lhs.hpp |
| 141 | ${HEADER_DIR}/internal/catch_fatal_condition.hpp |
| 142 | ${HEADER_DIR}/internal/catch_generators.hpp |
| 143 | ${HEADER_DIR}/internal/catch_generators_impl.hpp |
| 144 | ${HEADER_DIR}/internal/catch_impl.hpp |
| 145 | ${HEADER_DIR}/internal/catch_interfaces_capture.h |
| 146 | ${HEADER_DIR}/internal/catch_interfaces_config.h |
| 147 | ${HEADER_DIR}/internal/catch_interfaces_exception.h |
| 148 | ${HEADER_DIR}/internal/catch_interfaces_generators.h |
| 149 | ${HEADER_DIR}/internal/catch_interfaces_registry_hub.h |
| 150 | ${HEADER_DIR}/internal/catch_interfaces_reporter.h |
| 151 | ${HEADER_DIR}/internal/catch_interfaces_runner.h |
| 152 | ${HEADER_DIR}/internal/catch_interfaces_tag_alias_registry.h |
| 153 | ${HEADER_DIR}/internal/catch_interfaces_testcase.h |
| 154 | ${HEADER_DIR}/internal/catch_legacy_reporter_adapter.h |
| 155 | ${HEADER_DIR}/internal/catch_legacy_reporter_adapter.hpp |
| 156 | ${HEADER_DIR}/internal/catch_list.hpp |
| 157 | ${HEADER_DIR}/internal/catch_matchers.hpp |
Phil Nash | 1400127 | 2017-02-08 15:14:51 +0000 | [diff] [blame] | 158 | ${HEADER_DIR}/internal/catch_matchers_string.h |
Phil Nash | 7fed25a | 2017-02-08 14:17:17 +0000 | [diff] [blame] | 159 | ${HEADER_DIR}/internal/catch_matchers_string.hpp |
Phil Nash | 10dfca3 | 2017-02-21 16:05:04 +0000 | [diff] [blame] | 160 | ${HEADER_DIR}/internal/catch_matchers_vector.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 161 | ${HEADER_DIR}/internal/catch_message.h |
| 162 | ${HEADER_DIR}/internal/catch_message.hpp |
| 163 | ${HEADER_DIR}/internal/catch_notimplemented_exception.h |
| 164 | ${HEADER_DIR}/internal/catch_notimplemented_exception.hpp |
| 165 | ${HEADER_DIR}/internal/catch_objc.hpp |
| 166 | ${HEADER_DIR}/internal/catch_objc_arc.hpp |
| 167 | ${HEADER_DIR}/internal/catch_option.hpp |
| 168 | ${HEADER_DIR}/internal/catch_platform.h |
| 169 | ${HEADER_DIR}/internal/catch_ptr.hpp |
| 170 | ${HEADER_DIR}/internal/catch_reenable_warnings.h |
| 171 | ${HEADER_DIR}/internal/catch_registry_hub.hpp |
| 172 | ${HEADER_DIR}/internal/catch_reporter_registrars.hpp |
| 173 | ${HEADER_DIR}/internal/catch_reporter_registry.hpp |
| 174 | ${HEADER_DIR}/internal/catch_result_builder.h |
| 175 | ${HEADER_DIR}/internal/catch_result_builder.hpp |
| 176 | ${HEADER_DIR}/internal/catch_result_type.h |
| 177 | ${HEADER_DIR}/internal/catch_run_context.hpp |
| 178 | ${HEADER_DIR}/internal/catch_section.h |
| 179 | ${HEADER_DIR}/internal/catch_section.hpp |
| 180 | ${HEADER_DIR}/internal/catch_section_info.h |
| 181 | ${HEADER_DIR}/internal/catch_section_info.hpp |
| 182 | ${HEADER_DIR}/internal/catch_stream.h |
| 183 | ${HEADER_DIR}/internal/catch_stream.hpp |
| 184 | ${HEADER_DIR}/internal/catch_streambuf.h |
| 185 | ${HEADER_DIR}/internal/catch_suppress_warnings.h |
| 186 | ${HEADER_DIR}/internal/catch_tag_alias.h |
| 187 | ${HEADER_DIR}/internal/catch_tag_alias_registry.h |
| 188 | ${HEADER_DIR}/internal/catch_tag_alias_registry.hpp |
| 189 | ${HEADER_DIR}/internal/catch_test_case_info.h |
| 190 | ${HEADER_DIR}/internal/catch_test_case_info.hpp |
| 191 | ${HEADER_DIR}/internal/catch_test_case_registry_impl.hpp |
| 192 | ${HEADER_DIR}/internal/catch_test_case_tracker.hpp |
| 193 | ${HEADER_DIR}/internal/catch_test_registry.hpp |
| 194 | ${HEADER_DIR}/internal/catch_test_spec.hpp |
| 195 | ${HEADER_DIR}/internal/catch_test_spec_parser.hpp |
| 196 | ${HEADER_DIR}/internal/catch_text.h |
| 197 | ${HEADER_DIR}/internal/catch_timer.h |
| 198 | ${HEADER_DIR}/internal/catch_timer.hpp |
| 199 | ${HEADER_DIR}/internal/catch_tostring.h |
| 200 | ${HEADER_DIR}/internal/catch_tostring.hpp |
| 201 | ${HEADER_DIR}/internal/catch_totals.hpp |
Martin Hořeňovský | 73159ac | 2017-02-09 12:57:01 +0100 | [diff] [blame] | 202 | ${HEADER_DIR}/internal/catch_type_traits.hpp |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 203 | ${HEADER_DIR}/internal/catch_version.h |
| 204 | ${HEADER_DIR}/internal/catch_version.hpp |
| 205 | ${HEADER_DIR}/internal/catch_wildcard_pattern.hpp |
Martin Hořeňovský | 531d267 | 2017-01-16 19:56:57 +0100 | [diff] [blame] | 206 | ${HEADER_DIR}/internal/catch_windows_h_proxy.h |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 207 | ${HEADER_DIR}/internal/catch_xmlwriter.hpp |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 208 | ) |
| 209 | CheckFileList(INTERNAL_HEADERS ${HEADER_DIR}/internal) |
| 210 | |
| 211 | # Please keep these ordered alphabetically |
| 212 | set(REPORTER_HEADERS |
Justin Wilson | b753f05 | 2017-02-22 04:17:25 -0600 | [diff] [blame] | 213 | ${HEADER_DIR}/reporters/catch_reporter_automake.hpp |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 214 | ${HEADER_DIR}/reporters/catch_reporter_bases.hpp |
| 215 | ${HEADER_DIR}/reporters/catch_reporter_compact.hpp |
| 216 | ${HEADER_DIR}/reporters/catch_reporter_console.hpp |
| 217 | ${HEADER_DIR}/reporters/catch_reporter_junit.hpp |
| 218 | ${HEADER_DIR}/reporters/catch_reporter_multi.hpp |
Martin Hořeňovský | b0260c6 | 2017-02-22 13:28:13 +0100 | [diff] [blame] | 219 | ${HEADER_DIR}/reporters/catch_reporter_tap.hpp |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 220 | ${HEADER_DIR}/reporters/catch_reporter_teamcity.hpp |
| 221 | ${HEADER_DIR}/reporters/catch_reporter_xml.hpp |
| 222 | ) |
Martin Hořeňovský | e6ef60a | 2017-01-15 22:07:36 +0100 | [diff] [blame] | 223 | CheckFileList(REPORTER_HEADERS ${HEADER_DIR}/reporters) |
| 224 | |
| 225 | # Specify the headers, too, so CLion recognises them as project files |
| 226 | set(HEADERS |
| 227 | ${TOP_LEVEL_HEADERS} |
| 228 | ${EXTERNAL_HEADERS} |
| 229 | ${INTERNAL_HEADERS} |
| 230 | ${REPORTER_HEADERS} |
| 231 | ) |
| 232 | |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 233 | |
Martin Hořeňovský | 3b7511e | 2017-01-14 21:55:37 +0100 | [diff] [blame] | 234 | set(BENCH_SOURCES |
| 235 | ${BENCHMARK_DIR}/BenchMain.cpp |
| 236 | ${BENCHMARK_DIR}/StringificationBench.cpp |
| 237 | ) |
Martin Hořeňovský | dab1d9d | 2017-01-25 23:02:25 +0100 | [diff] [blame] | 238 | CheckFileList(BENCH_SOURCES ${BENCHMARK_DIR}) |
| 239 | |
Phil Nash | d5360e8 | 2017-01-12 11:54:53 +0000 | [diff] [blame] | 240 | # Provide some groupings for IDEs |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 241 | SOURCE_GROUP("Tests" FILES ${TEST_SOURCES}) |
| 242 | SOURCE_GROUP("Surrogates" FILES ${IMPL_SOURCES}) |
Martin Hořeňovský | 3b7511e | 2017-01-14 21:55:37 +0100 | [diff] [blame] | 243 | SOURCE_GROUP("Benchmarks" FILES ${BENCH_SOURCES}) |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 244 | |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 245 | # configure the executable |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 246 | include_directories(${HEADER_DIR}) |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 247 | add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${HEADERS}) |
Martin Hořeňovský | 3b7511e | 2017-01-14 21:55:37 +0100 | [diff] [blame] | 248 | add_executable(Benchmark ${BENCH_SOURCES} ${HEADERS}) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 249 | |
Martin Hořeňovský | 7ae96c7 | 2017-01-31 17:37:27 +0100 | [diff] [blame] | 250 | # Add desired warnings |
| 251 | if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" ) |
| 252 | target_compile_options( SelfTest PRIVATE -Wall -Wextra ) |
| 253 | target_compile_options( Benchmark PRIVATE -Wall -Wextra ) |
| 254 | endif() |
| 255 | if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) |
| 256 | target_compile_options( SelfTest PRIVATE /W4 ) |
| 257 | target_compile_options( Benchmark PRIVATE /W4 ) |
| 258 | endif() |
| 259 | |
| 260 | |
Fraser Hutchison | 69a3f16 | 2013-10-24 02:57:46 +0100 | [diff] [blame] | 261 | # configure unit tests via CTest |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 262 | enable_testing() |
Fraser Hutchison | 69a3f16 | 2013-10-24 02:57:46 +0100 | [diff] [blame] | 263 | add_test(NAME RunTests COMMAND SelfTest) |
| 264 | |
| 265 | add_test(NAME ListTests COMMAND SelfTest --list-tests) |
| 266 | set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") |
| 267 | |
| 268 | add_test(NAME ListTags COMMAND SelfTest --list-tags) |
| 269 | set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") |
Saad K | 7dd4f29 | 2017-01-31 14:22:45 -0500 | [diff] [blame] | 270 | |
| 271 | install(DIRECTORY "single_include/" DESTINATION "include/catch/") |