2013-08-05 12:40:33 +02:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
|
2013-10-24 03:57:46 +02:00
|
|
|
project(Catch)
|
2013-08-05 12:40:33 +02:00
|
|
|
|
|
|
|
# define some folders
|
2013-10-24 03:57:46 +02:00
|
|
|
get_filename_component(CATCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
|
|
|
|
get_filename_component(CATCH_DIR "${CATCH_DIR}" PATH)
|
2013-08-05 12:40:33 +02:00
|
|
|
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
|
2014-09-04 01:32:05 +02:00
|
|
|
if(USE_CPP11)
|
|
|
|
## We can't turn this on by default, since it breaks on travis
|
|
|
|
message(STATUS "Enabling C++11")
|
|
|
|
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
|
|
|
|
endif()
|
2013-08-05 12:40:33 +02:00
|
|
|
|
|
|
|
# define the sources of the self test
|
2013-10-24 03:57:46 +02:00
|
|
|
set(SOURCES
|
|
|
|
${SELF_TEST_DIR}/ApproxTests.cpp
|
|
|
|
${SELF_TEST_DIR}/BDDTests.cpp
|
|
|
|
${SELF_TEST_DIR}/ClassTests.cpp
|
|
|
|
${SELF_TEST_DIR}/ConditionTests.cpp
|
|
|
|
${SELF_TEST_DIR}/ExceptionTests.cpp
|
|
|
|
${SELF_TEST_DIR}/GeneratorTests.cpp
|
|
|
|
${SELF_TEST_DIR}/MessageTests.cpp
|
|
|
|
${SELF_TEST_DIR}/MiscTests.cpp
|
2015-11-03 18:06:24 +01:00
|
|
|
${SELF_TEST_DIR}/PartTrackerTests.cpp
|
2013-10-24 03:57:46 +02:00
|
|
|
${SELF_TEST_DIR}/TestMain.cpp
|
|
|
|
${SELF_TEST_DIR}/TrickyTests.cpp
|
|
|
|
${SELF_TEST_DIR}/VariadicMacrosTests.cpp
|
2014-09-01 19:27:29 +02:00
|
|
|
${SELF_TEST_DIR}/EnumToString.cpp
|
|
|
|
${SELF_TEST_DIR}/ToStringPair.cpp
|
|
|
|
${SELF_TEST_DIR}/ToStringVector.cpp
|
|
|
|
${SELF_TEST_DIR}/ToStringWhich.cpp
|
2014-09-04 01:32:05 +02:00
|
|
|
${SELF_TEST_DIR}/ToStringTuple.cpp
|
2013-08-05 12:40:33 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# configure the executable
|
2013-08-05 12:57:29 +02:00
|
|
|
include_directories(${CATCH_DIR}/include)
|
2013-08-05 12:40:33 +02:00
|
|
|
add_executable(SelfTest ${SOURCES})
|
|
|
|
|
2013-10-24 03:57:46 +02:00
|
|
|
# configure unit tests via CTest
|
2013-08-05 12:40:33 +02:00
|
|
|
enable_testing()
|
2013-10-24 03:57:46 +02:00
|
|
|
add_test(NAME RunTests COMMAND SelfTest)
|
|
|
|
|
|
|
|
add_test(NAME ListTests COMMAND SelfTest --list-tests)
|
|
|
|
set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases")
|
|
|
|
|
|
|
|
add_test(NAME ListTags COMMAND SelfTest --list-tags)
|
|
|
|
set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")
|