Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8) |
| 2 | |
Fraser Hutchison | 69a3f16 | 2013-10-24 02:57:46 +0100 | [diff] [blame] | 3 | project(Catch) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 4 | |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 5 | # define some folders |
Phil Nash | c8fefc4 | 2017-01-06 16:19:20 +0000 | [diff] [blame^] | 6 | set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 7 | set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest) |
Andy Sawyer | 13cbdf7 | 2014-09-04 00:32:05 +0100 | [diff] [blame] | 8 | if(USE_CPP11) |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 9 | ## We can't turn this on by default, since it breaks on travis |
| 10 | message(STATUS "Enabling C++11") |
| 11 | set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") |
Andy Sawyer | 13cbdf7 | 2014-09-04 00:32:05 +0100 | [diff] [blame] | 12 | endif() |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 13 | |
| 14 | # define the sources of the self test |
Fraser Hutchison | 69a3f16 | 2013-10-24 02:57:46 +0100 | [diff] [blame] | 15 | set(SOURCES |
Phil Nash | 30cebd6 | 2016-11-09 22:55:32 +0000 | [diff] [blame] | 16 | ${SELF_TEST_DIR}/ApproxTests.cpp |
| 17 | ${SELF_TEST_DIR}/BDDTests.cpp |
| 18 | ${SELF_TEST_DIR}/ClassTests.cpp |
| 19 | ${SELF_TEST_DIR}/ConditionTests.cpp |
| 20 | ${SELF_TEST_DIR}/ExceptionTests.cpp |
| 21 | ${SELF_TEST_DIR}/GeneratorTests.cpp |
| 22 | ${SELF_TEST_DIR}/MessageTests.cpp |
| 23 | ${SELF_TEST_DIR}/MiscTests.cpp |
| 24 | ${SELF_TEST_DIR}/PartTrackerTests.cpp |
| 25 | ${SELF_TEST_DIR}/TestMain.cpp |
| 26 | ${SELF_TEST_DIR}/TrickyTests.cpp |
| 27 | ${SELF_TEST_DIR}/VariadicMacrosTests.cpp |
| 28 | ${SELF_TEST_DIR}/EnumToString.cpp |
| 29 | ${SELF_TEST_DIR}/ToStringPair.cpp |
| 30 | ${SELF_TEST_DIR}/ToStringVector.cpp |
| 31 | ${SELF_TEST_DIR}/ToStringWhich.cpp |
| 32 | ${SELF_TEST_DIR}/ToStringTuple.cpp |
| 33 | ${SELF_TEST_DIR}/CmdLineTests.cpp |
| 34 | ${SELF_TEST_DIR}/TagAliasTests.cpp |
| 35 | ${SELF_TEST_DIR}/SurrogateCpps/catch_common.cpp |
| 36 | ${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp |
| 37 | ${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp |
| 38 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_capture.cpp |
| 39 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_config.cpp |
| 40 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_exception.cpp |
| 41 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_generators.cpp |
| 42 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_registry_hub.cpp |
| 43 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp |
| 44 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_runner.cpp |
| 45 | ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_testcase.cpp |
| 46 | ${SELF_TEST_DIR}/SurrogateCpps/catch_message.cpp |
| 47 | ${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp |
| 48 | ${SELF_TEST_DIR}/SurrogateCpps/catch_ptr.cpp |
| 49 | ${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp |
| 50 | ${SELF_TEST_DIR}/SurrogateCpps/catch_streambuf.cpp |
| 51 | ${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp |
| 52 | ${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp |
| 53 | ) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 54 | |
| 55 | # configure the executable |
Kosta | 5553a53 | 2013-08-05 12:57:29 +0200 | [diff] [blame] | 56 | include_directories(${CATCH_DIR}/include) |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 57 | add_executable(SelfTest ${SOURCES}) |
| 58 | |
Fraser Hutchison | 69a3f16 | 2013-10-24 02:57:46 +0100 | [diff] [blame] | 59 | # configure unit tests via CTest |
Kosta | ce441a9 | 2013-08-05 12:40:33 +0200 | [diff] [blame] | 60 | enable_testing() |
Fraser Hutchison | 69a3f16 | 2013-10-24 02:57:46 +0100 | [diff] [blame] | 61 | add_test(NAME RunTests COMMAND SelfTest) |
| 62 | |
| 63 | add_test(NAME ListTests COMMAND SelfTest --list-tests) |
| 64 | set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") |
| 65 | |
| 66 | add_test(NAME ListTags COMMAND SelfTest --list-tags) |
| 67 | set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") |