blob: eb0e1893d4622434105ccff62f5ca57b65e814d6 [file] [log] [blame]
Kostace441a92013-08-05 12:40:33 +02001cmake_minimum_required(VERSION 2.8)
2
Fraser Hutchison69a3f162013-10-24 02:57:46 +01003project(Catch)
Kostace441a92013-08-05 12:40:33 +02004
Kostace441a92013-08-05 12:40:33 +02005# define some folders
Phil Nashc8fefc42017-01-06 16:19:20 +00006set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Kostace441a92013-08-05 12:40:33 +02007set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
Andy Sawyer13cbdf72014-09-04 00:32:05 +01008if(USE_CPP11)
Phil Nash30cebd62016-11-09 22:55:32 +00009 ## 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 Sawyer13cbdf72014-09-04 00:32:05 +010012endif()
Kostace441a92013-08-05 12:40:33 +020013
14# define the sources of the self test
Fraser Hutchison69a3f162013-10-24 02:57:46 +010015set(SOURCES
Phil Nash30cebd62016-11-09 22:55:32 +000016 ${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 )
Kostace441a92013-08-05 12:40:33 +020054
55# configure the executable
Kosta5553a532013-08-05 12:57:29 +020056include_directories(${CATCH_DIR}/include)
Kostace441a92013-08-05 12:40:33 +020057add_executable(SelfTest ${SOURCES})
58
Fraser Hutchison69a3f162013-10-24 02:57:46 +010059# configure unit tests via CTest
Kostace441a92013-08-05 12:40:33 +020060enable_testing()
Fraser Hutchison69a3f162013-10-24 02:57:46 +010061add_test(NAME RunTests COMMAND SelfTest)
62
63add_test(NAME ListTests COMMAND SelfTest --list-tests)
64set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases")
65
66add_test(NAME ListTags COMMAND SelfTest --list-tags)
67set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")