Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8) |
| 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) |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 10 | set(HEADER_DIR ${CATCH_DIR}/include) |
| 11 | |
Andy Sawyer | 13cbdf7 | 2014-09-04 00:32:05 +0100 | [diff] [blame] | 12 | if(USE_CPP11) |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 13 | ## We can't turn this on by default, since it breaks on travis |
| 14 | message(STATUS "Enabling C++11") |
| 15 | set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") |
Andy Sawyer | 13cbdf7 | 2014-09-04 00:32:05 +0100 | [diff] [blame] | 16 | endif() |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 17 | |
| 18 | # define the sources of the self test |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 19 | set(TEST_SOURCES |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 20 | ${SELF_TEST_DIR}/ApproxTests.cpp |
| 21 | ${SELF_TEST_DIR}/BDDTests.cpp |
| 22 | ${SELF_TEST_DIR}/ClassTests.cpp |
| 23 | ${SELF_TEST_DIR}/ConditionTests.cpp |
| 24 | ${SELF_TEST_DIR}/ExceptionTests.cpp |
| 25 | ${SELF_TEST_DIR}/GeneratorTests.cpp |
| 26 | ${SELF_TEST_DIR}/MessageTests.cpp |
| 27 | ${SELF_TEST_DIR}/MiscTests.cpp |
| 28 | ${SELF_TEST_DIR}/PartTrackerTests.cpp |
| 29 | ${SELF_TEST_DIR}/TestMain.cpp |
| 30 | ${SELF_TEST_DIR}/TrickyTests.cpp |
| 31 | ${SELF_TEST_DIR}/VariadicMacrosTests.cpp |
| 32 | ${SELF_TEST_DIR}/EnumToString.cpp |
| 33 | ${SELF_TEST_DIR}/ToStringPair.cpp |
| 34 | ${SELF_TEST_DIR}/ToStringVector.cpp |
| 35 | ${SELF_TEST_DIR}/ToStringWhich.cpp |
| 36 | ${SELF_TEST_DIR}/ToStringTuple.cpp |
| 37 | ${SELF_TEST_DIR}/CmdLineTests.cpp |
| 38 | ${SELF_TEST_DIR}/TagAliasTests.cpp |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 39 | ) |
| 40 | set(IMPL_SOURCES |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 41 | ${SELF_TEST_DIR}/SurrogateCpps/catch_common.cpp |
| 42 | ${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp |
| 43 | ${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp |
| 44 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_capture.cpp |
| 45 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_config.cpp |
| 46 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_exception.cpp |
| 47 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_generators.cpp |
| 48 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_registry_hub.cpp |
| 49 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp |
| 50 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_runner.cpp |
| 51 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_testcase.cpp |
| 52 | ${SELF_TEST_DIR}/SurrogateCpps/catch_message.cpp |
| 53 | ${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp |
| 54 | ${SELF_TEST_DIR}/SurrogateCpps/catch_ptr.cpp |
| 55 | ${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp |
| 56 | ${SELF_TEST_DIR}/SurrogateCpps/catch_streambuf.cpp |
| 57 | ${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp |
| 58 | ${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp |
| 59 | ) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 60 | |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 61 | # Specify the headers, too, so CLion recognises them as project files |
| 62 | set(HEADERS |
| 63 | ${HEADER_DIR}/catch.hpp |
| 64 | ${HEADER_DIR}/catch_session.hpp |
| 65 | ${HEADER_DIR}/catch_with_main.hpp |
| 66 | ${HEADER_DIR}/internal/catch_approx.hpp |
| 67 | ${HEADER_DIR}/internal/catch_assertionresult.h |
| 68 | ${HEADER_DIR}/internal/catch_assertionresult.hpp |
| 69 | ${HEADER_DIR}/internal/catch_capture.hpp |
| 70 | ${HEADER_DIR}/internal/catch_clara.h |
| 71 | ${HEADER_DIR}/internal/catch_commandline.hpp |
| 72 | ${HEADER_DIR}/internal/catch_common.h |
| 73 | ${HEADER_DIR}/internal/catch_common.hpp |
| 74 | ${HEADER_DIR}/internal/catch_compiler_capabilities.h |
| 75 | ${HEADER_DIR}/internal/catch_config.hpp |
| 76 | ${HEADER_DIR}/internal/catch_console_colour.hpp |
| 77 | ${HEADER_DIR}/internal/catch_console_colour_impl.hpp |
| 78 | ${HEADER_DIR}/internal/catch_context.h |
| 79 | ${HEADER_DIR}/internal/catch_context_impl.hpp |
| 80 | ${HEADER_DIR}/internal/catch_debugger.h |
| 81 | ${HEADER_DIR}/internal/catch_debugger.hpp |
| 82 | ${HEADER_DIR}/internal/catch_default_main.hpp |
| 83 | ${HEADER_DIR}/internal/catch_evaluate.hpp |
| 84 | ${HEADER_DIR}/internal/catch_exception_translator_registry.hpp |
| 85 | ${HEADER_DIR}/internal/catch_expression_lhs.hpp |
| 86 | ${HEADER_DIR}/internal/catch_fatal_condition.hpp |
| 87 | ${HEADER_DIR}/internal/catch_generators.hpp |
| 88 | ${HEADER_DIR}/internal/catch_generators_impl.hpp |
| 89 | ${HEADER_DIR}/internal/catch_impl.hpp |
| 90 | ${HEADER_DIR}/internal/catch_interfaces_capture.h |
| 91 | ${HEADER_DIR}/internal/catch_interfaces_config.h |
| 92 | ${HEADER_DIR}/internal/catch_interfaces_exception.h |
| 93 | ${HEADER_DIR}/internal/catch_interfaces_generators.h |
| 94 | ${HEADER_DIR}/internal/catch_interfaces_registry_hub.h |
| 95 | ${HEADER_DIR}/internal/catch_interfaces_reporter.h |
| 96 | ${HEADER_DIR}/internal/catch_interfaces_runner.h |
| 97 | ${HEADER_DIR}/internal/catch_interfaces_tag_alias_registry.h |
| 98 | ${HEADER_DIR}/internal/catch_interfaces_testcase.h |
| 99 | ${HEADER_DIR}/internal/catch_legacy_reporter_adapter.h |
| 100 | ${HEADER_DIR}/internal/catch_legacy_reporter_adapter.hpp |
| 101 | ${HEADER_DIR}/internal/catch_list.hpp |
| 102 | ${HEADER_DIR}/internal/catch_matchers.hpp |
| 103 | ${HEADER_DIR}/internal/catch_message.h |
| 104 | ${HEADER_DIR}/internal/catch_message.hpp |
| 105 | ${HEADER_DIR}/internal/catch_notimplemented_exception.h |
| 106 | ${HEADER_DIR}/internal/catch_notimplemented_exception.hpp |
| 107 | ${HEADER_DIR}/internal/catch_objc.hpp |
| 108 | ${HEADER_DIR}/internal/catch_objc_arc.hpp |
| 109 | ${HEADER_DIR}/internal/catch_option.hpp |
| 110 | ${HEADER_DIR}/internal/catch_platform.h |
| 111 | ${HEADER_DIR}/internal/catch_ptr.hpp |
| 112 | ${HEADER_DIR}/internal/catch_reenable_warnings.h |
| 113 | ${HEADER_DIR}/internal/catch_registry_hub.hpp |
| 114 | ${HEADER_DIR}/internal/catch_reporter_registrars.hpp |
| 115 | ${HEADER_DIR}/internal/catch_reporter_registry.hpp |
| 116 | ${HEADER_DIR}/internal/catch_result_builder.h |
| 117 | ${HEADER_DIR}/internal/catch_result_builder.hpp |
| 118 | ${HEADER_DIR}/internal/catch_result_type.h |
| 119 | ${HEADER_DIR}/internal/catch_run_context.hpp |
| 120 | ${HEADER_DIR}/internal/catch_section.h |
| 121 | ${HEADER_DIR}/internal/catch_section.hpp |
| 122 | ${HEADER_DIR}/internal/catch_section_info.h |
| 123 | ${HEADER_DIR}/internal/catch_section_info.hpp |
| 124 | ${HEADER_DIR}/internal/catch_stream.h |
| 125 | ${HEADER_DIR}/internal/catch_stream.hpp |
| 126 | ${HEADER_DIR}/internal/catch_streambuf.h |
| 127 | ${HEADER_DIR}/internal/catch_suppress_warnings.h |
| 128 | ${HEADER_DIR}/internal/catch_tag_alias.h |
| 129 | ${HEADER_DIR}/internal/catch_tag_alias_registry.h |
| 130 | ${HEADER_DIR}/internal/catch_tag_alias_registry.hpp |
| 131 | ${HEADER_DIR}/internal/catch_test_case_info.h |
| 132 | ${HEADER_DIR}/internal/catch_test_case_info.hpp |
| 133 | ${HEADER_DIR}/internal/catch_test_case_registry_impl.hpp |
| 134 | ${HEADER_DIR}/internal/catch_test_case_tracker.hpp |
| 135 | ${HEADER_DIR}/internal/catch_test_registry.hpp |
| 136 | ${HEADER_DIR}/internal/catch_test_spec.hpp |
| 137 | ${HEADER_DIR}/internal/catch_test_spec_parser.hpp |
| 138 | ${HEADER_DIR}/internal/catch_text.h |
| 139 | ${HEADER_DIR}/internal/catch_timer.h |
| 140 | ${HEADER_DIR}/internal/catch_timer.hpp |
| 141 | ${HEADER_DIR}/internal/catch_tostring.h |
| 142 | ${HEADER_DIR}/internal/catch_tostring.hpp |
| 143 | ${HEADER_DIR}/internal/catch_totals.hpp |
| 144 | ${HEADER_DIR}/internal/catch_version.h |
| 145 | ${HEADER_DIR}/internal/catch_version.hpp |
| 146 | ${HEADER_DIR}/internal/catch_wildcard_pattern.hpp |
| 147 | ${HEADER_DIR}/internal/catch_xmlwriter.hpp |
| 148 | ${HEADER_DIR}/external/clara.h |
| 149 | ${HEADER_DIR}/external/tbc_text_format.h |
| 150 | ${HEADER_DIR}/reporters/catch_reporter_bases.hpp |
| 151 | ${HEADER_DIR}/reporters/catch_reporter_compact.hpp |
| 152 | ${HEADER_DIR}/reporters/catch_reporter_console.hpp |
| 153 | ${HEADER_DIR}/reporters/catch_reporter_junit.hpp |
| 154 | ${HEADER_DIR}/reporters/catch_reporter_multi.hpp |
| 155 | ${HEADER_DIR}/reporters/catch_reporter_teamcity.hpp |
| 156 | ${HEADER_DIR}/reporters/catch_reporter_xml.hpp |
| 157 | ) |
| 158 | |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 159 | SOURCE_GROUP("Tests" FILES ${TEST_SOURCES}) |
| 160 | SOURCE_GROUP("Surrogates" FILES ${IMPL_SOURCES}) |
| 161 | |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 162 | # configure the executable |
Phil Nash | e1fbbe1 | 2017-01-06 16:59:18 +0000 | [diff] [blame] | 163 | include_directories(${HEADER_DIR}) |
Phil Nash | 8abe17a | 2017-01-09 16:27:06 +0000 | [diff] [blame] | 164 | add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${HEADERS}) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 165 | |
Fraser Hutchison | 69a3f16 | 2013-10-24 02:57:46 +0100 | [diff] [blame] | 166 | # configure unit tests via CTest |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 167 | enable_testing() |
Fraser Hutchison | 69a3f16 | 2013-10-24 02:57:46 +0100 | [diff] [blame] | 168 | add_test(NAME RunTests COMMAND SelfTest) |
| 169 | |
| 170 | add_test(NAME ListTests COMMAND SelfTest --list-tests) |
| 171 | set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") |
| 172 | |
| 173 | add_test(NAME ListTags COMMAND SelfTest --list-tags) |
| 174 | set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") |