2017-01-31 20:21:03 +01:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
2013-08-05 12:40:33 +02:00
|
|
|
|
2018-01-18 00:01:27 +01:00
|
|
|
# detect if Catch is being bundled,
|
|
|
|
# disable testsuite in that case
|
|
|
|
if(NOT DEFINED PROJECT_NAME)
|
|
|
|
set(NOT_SUBPROJECT ON)
|
|
|
|
endif()
|
|
|
|
|
2017-01-09 18:32:57 +01:00
|
|
|
project(CatchSelfTest)
|
2013-08-05 12:40:33 +02:00
|
|
|
|
2018-01-18 00:01:27 +01:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2017-11-05 12:46:04 +01:00
|
|
|
option(USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
|
2017-11-19 15:04:51 +01:00
|
|
|
option(BUILD_EXAMPLES "Build documentation examples" OFF)
|
2017-11-25 16:58:29 +01:00
|
|
|
option(ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
|
2018-01-14 18:14:11 +01:00
|
|
|
option(DISABLE_WERROR "Do not enable warnings as errors" OFF)
|
2017-11-05 12:46:04 +01:00
|
|
|
|
2017-01-09 17:27:06 +01:00
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
2013-08-05 12:40:33 +02:00
|
|
|
# define some folders
|
2017-01-06 17:19:20 +01:00
|
|
|
set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
2013-08-05 12:40:33 +02:00
|
|
|
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
|
2017-01-14 21:55:37 +01:00
|
|
|
set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark)
|
2017-01-06 17:59:18 +01:00
|
|
|
set(HEADER_DIR ${CATCH_DIR}/include)
|
2018-01-10 13:53:04 +01:00
|
|
|
set(CATCH_VERSION_NUMBER 2.1.0)
|
2017-01-06 17:59:18 +01:00
|
|
|
|
2017-05-11 13:00:03 +02:00
|
|
|
if(USE_WMAIN)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
|
|
|
|
endif()
|
|
|
|
|
2017-01-15 22:07:36 +01:00
|
|
|
#checks that the given hard-coded list contains all headers + sources in the given folder
|
|
|
|
function(CheckFileList LIST_VAR FOLDER)
|
|
|
|
set(MESSAGE " should be added to the variable ${LIST_VAR}")
|
|
|
|
set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n")
|
|
|
|
file(GLOB GLOBBED_LIST "${FOLDER}/*.cpp"
|
|
|
|
"${FOLDER}/*.hpp"
|
|
|
|
"${FOLDER}/*.h")
|
|
|
|
list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}})
|
|
|
|
foreach(EXTRA_ITEM ${GLOBBED_LIST})
|
|
|
|
string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}")
|
|
|
|
message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}")
|
|
|
|
endforeach()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(CheckFileListRec LIST_VAR FOLDER)
|
|
|
|
set(MESSAGE " should be added to the variable ${LIST_VAR}")
|
|
|
|
set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n")
|
|
|
|
file(GLOB_RECURSE GLOBBED_LIST "${FOLDER}/*.cpp"
|
|
|
|
"${FOLDER}/*.hpp"
|
|
|
|
"${FOLDER}/*.h")
|
|
|
|
list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}})
|
|
|
|
foreach(EXTRA_ITEM ${GLOBBED_LIST})
|
|
|
|
string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}")
|
|
|
|
message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}")
|
|
|
|
endforeach()
|
|
|
|
endfunction()
|
|
|
|
|
2013-08-05 12:40:33 +02:00
|
|
|
# define the sources of the self test
|
2017-01-12 12:54:53 +01:00
|
|
|
# Please keep these ordered alphabetically
|
2017-01-09 17:27:06 +01:00
|
|
|
set(TEST_SOURCES
|
2017-11-13 17:03:27 +01:00
|
|
|
${SELF_TEST_DIR}/TestMain.cpp
|
|
|
|
${SELF_TEST_DIR}/IntrospectiveTests/CmdLine.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/IntrospectiveTests/PartTracker.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/IntrospectiveTests/TagAlias.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/IntrospectiveTests/String.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/Approx.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/BDD.tests.cpp
|
2017-11-13 16:38:52 +01:00
|
|
|
${SELF_TEST_DIR}/UsageTests/Benchmark.tests.cpp
|
2017-11-13 17:03:27 +01:00
|
|
|
${SELF_TEST_DIR}/UsageTests/Class.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/Compilation.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/Condition.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/Decomposition.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/EnumToString.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/Exception.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/Message.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/Misc.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/ToStringChrono.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/ToStringGeneral.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/ToStringPair.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/ToStringTuple.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/ToStringVector.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/ToStringWhich.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/Tricky.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/VariadicMacros.tests.cpp
|
|
|
|
${SELF_TEST_DIR}/UsageTests/Matchers.tests.cpp
|
2017-01-09 17:27:06 +01:00
|
|
|
)
|
2017-01-15 22:07:36 +01:00
|
|
|
CheckFileList(TEST_SOURCES ${SELF_TEST_DIR})
|
2017-01-12 12:54:53 +01:00
|
|
|
|
|
|
|
# A set of impl files that just #include a single header
|
|
|
|
# Please keep these ordered alphabetically
|
2017-07-06 22:28:42 +02:00
|
|
|
set(SURROGATE_SOURCES
|
2016-11-09 23:55:32 +01:00
|
|
|
${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp
|
|
|
|
${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp
|
|
|
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp
|
|
|
|
${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp
|
|
|
|
${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp
|
2017-08-05 12:12:29 +02:00
|
|
|
${SELF_TEST_DIR}/SurrogateCpps/catch_test_case_tracker.cpp
|
2016-11-09 23:55:32 +01:00
|
|
|
${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp
|
|
|
|
${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp
|
|
|
|
)
|
2017-07-06 22:28:42 +02:00
|
|
|
CheckFileList(SURROGATE_SOURCES ${SELF_TEST_DIR}/SurrogateCpps)
|
2017-01-15 22:07:36 +01:00
|
|
|
|
2013-08-05 12:40:33 +02:00
|
|
|
|
2017-01-12 12:54:53 +01:00
|
|
|
# Please keep these ordered alphabetically
|
2017-01-15 22:07:36 +01:00
|
|
|
set(TOP_LEVEL_HEADERS
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/catch.hpp
|
|
|
|
${HEADER_DIR}/catch_with_main.hpp
|
2017-01-15 22:07:36 +01:00
|
|
|
)
|
|
|
|
CheckFileList(TOP_LEVEL_HEADERS ${HEADER_DIR})
|
2017-01-25 23:02:25 +01:00
|
|
|
|
2017-01-15 22:07:36 +01:00
|
|
|
# Please keep these ordered alphabetically
|
|
|
|
set(EXTERNAL_HEADERS
|
2017-06-13 00:04:24 +02:00
|
|
|
${HEADER_DIR}/external/clara.hpp
|
2017-01-15 22:07:36 +01:00
|
|
|
)
|
|
|
|
CheckFileList(EXTERNAL_HEADERS ${HEADER_DIR}/external)
|
|
|
|
|
2017-01-25 23:02:25 +01:00
|
|
|
|
2017-01-15 22:07:36 +01:00
|
|
|
# Please keep these ordered alphabetically
|
|
|
|
set(INTERNAL_HEADERS
|
2017-09-07 13:58:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_approx.h
|
2017-08-08 18:53:01 +02:00
|
|
|
${HEADER_DIR}/internal/catch_assertionhandler.h
|
|
|
|
${HEADER_DIR}/internal/catch_assertioninfo.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_assertionresult.h
|
|
|
|
${HEADER_DIR}/internal/catch_capture.hpp
|
2017-08-09 13:10:14 +02:00
|
|
|
${HEADER_DIR}/internal/catch_capture_matchers.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_clara.h
|
2017-09-07 13:58:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_commandline.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_common.h
|
|
|
|
${HEADER_DIR}/internal/catch_compiler_capabilities.h
|
|
|
|
${HEADER_DIR}/internal/catch_config.hpp
|
2017-09-07 13:58:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_console_colour.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_context.h
|
2017-08-29 13:51:55 +02:00
|
|
|
${HEADER_DIR}/internal/catch_debug_console.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_debugger.h
|
2017-08-08 18:53:01 +02:00
|
|
|
${HEADER_DIR}/internal/catch_decomposer.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_default_main.hpp
|
2017-08-01 18:46:33 +02:00
|
|
|
${HEADER_DIR}/internal/catch_enforce.h
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_errno_guard.h
|
2017-07-10 14:25:38 +02:00
|
|
|
${HEADER_DIR}/internal/catch_exception_translator_registry.h
|
2017-08-17 20:21:06 +02:00
|
|
|
${HEADER_DIR}/internal/catch_external_interfaces.h
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_fatal_condition.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_impl.hpp
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_capture.h
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_config.h
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_exception.h
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_registry_hub.h
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_reporter.h
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_runner.h
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_tag_alias_registry.h
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_testcase.h
|
2017-07-12 14:47:36 +02:00
|
|
|
${HEADER_DIR}/internal/catch_leak_detector.h
|
2017-07-10 14:25:38 +02:00
|
|
|
${HEADER_DIR}/internal/catch_list.h
|
2017-09-07 13:58:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_matchers.h
|
2017-11-10 18:14:42 +01:00
|
|
|
${HEADER_DIR}/internal/catch_matchers_floating.h
|
2017-02-08 16:14:51 +01:00
|
|
|
${HEADER_DIR}/internal/catch_matchers_string.h
|
2017-02-21 17:05:04 +01:00
|
|
|
${HEADER_DIR}/internal/catch_matchers_vector.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_message.h
|
|
|
|
${HEADER_DIR}/internal/catch_objc.hpp
|
|
|
|
${HEADER_DIR}/internal/catch_objc_arc.hpp
|
|
|
|
${HEADER_DIR}/internal/catch_option.hpp
|
|
|
|
${HEADER_DIR}/internal/catch_platform.h
|
2017-08-30 15:32:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_random_number_generator.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_reenable_warnings.h
|
|
|
|
${HEADER_DIR}/internal/catch_reporter_registrars.hpp
|
2017-09-07 16:51:33 +02:00
|
|
|
${HEADER_DIR}/internal/catch_reporter_registry.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_result_type.h
|
2017-09-07 13:58:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_run_context.h
|
2017-08-04 20:23:30 +02:00
|
|
|
${HEADER_DIR}/internal/catch_benchmark.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_section.h
|
|
|
|
${HEADER_DIR}/internal/catch_section_info.h
|
2017-08-31 10:31:52 +02:00
|
|
|
${HEADER_DIR}/internal/catch_session.h
|
2017-06-04 21:39:27 +02:00
|
|
|
${HEADER_DIR}/internal/catch_startup_exception_registry.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_stream.h
|
2017-06-29 12:18:14 +02:00
|
|
|
${HEADER_DIR}/internal/catch_stringref.h
|
2017-07-25 21:57:35 +02:00
|
|
|
${HEADER_DIR}/internal/catch_string_manip.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_suppress_warnings.h
|
|
|
|
${HEADER_DIR}/internal/catch_tag_alias.h
|
2017-07-27 11:55:30 +02:00
|
|
|
${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_tag_alias_registry.h
|
|
|
|
${HEADER_DIR}/internal/catch_test_case_info.h
|
2017-09-07 13:58:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_test_case_registry_impl.h
|
|
|
|
${HEADER_DIR}/internal/catch_test_case_tracker.h
|
|
|
|
${HEADER_DIR}/internal/catch_test_registry.h
|
|
|
|
${HEADER_DIR}/internal/catch_test_spec.h
|
|
|
|
${HEADER_DIR}/internal/catch_test_spec_parser.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_text.h
|
|
|
|
${HEADER_DIR}/internal/catch_timer.h
|
|
|
|
${HEADER_DIR}/internal/catch_tostring.h
|
2017-09-07 13:58:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_totals.h
|
2017-11-21 11:10:07 +01:00
|
|
|
${HEADER_DIR}/internal/catch_user_interfaces.h
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/internal/catch_version.h
|
2017-09-07 13:58:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_wildcard_pattern.h
|
2017-01-16 19:56:57 +01:00
|
|
|
${HEADER_DIR}/internal/catch_windows_h_proxy.h
|
2017-09-07 13:58:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_xmlwriter.h
|
2017-01-15 22:07:36 +01:00
|
|
|
)
|
2017-07-06 22:28:42 +02:00
|
|
|
set(IMPL_SOURCES
|
2017-07-19 10:01:06 +02:00
|
|
|
${HEADER_DIR}/internal/catch_approx.cpp
|
2017-08-08 18:53:01 +02:00
|
|
|
${HEADER_DIR}/internal/catch_assertionhandler.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_assertionresult.cpp
|
2017-08-04 20:23:30 +02:00
|
|
|
${HEADER_DIR}/internal/catch_benchmark.cpp
|
2017-08-09 13:10:14 +02:00
|
|
|
${HEADER_DIR}/internal/catch_capture_matchers.cpp
|
2017-07-10 14:25:38 +02:00
|
|
|
${HEADER_DIR}/internal/catch_commandline.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_common.cpp
|
2017-07-19 10:13:47 +02:00
|
|
|
${HEADER_DIR}/internal/catch_config.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_console_colour.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_context.cpp
|
2017-08-29 13:51:55 +02:00
|
|
|
${HEADER_DIR}/internal/catch_debug_console.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_debugger.cpp
|
2017-08-08 18:53:01 +02:00
|
|
|
${HEADER_DIR}/internal/catch_decomposer.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_errno_guard.cpp
|
2017-07-10 14:25:38 +02:00
|
|
|
${HEADER_DIR}/internal/catch_exception_translator_registry.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_fatal_condition.cpp
|
2017-09-07 16:51:33 +02:00
|
|
|
${HEADER_DIR}/internal/catch_interfaces_capture.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_config.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_exception.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_registry_hub.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_runner.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_interfaces_testcase.cpp
|
2017-07-10 14:25:38 +02:00
|
|
|
${HEADER_DIR}/internal/catch_list.cpp
|
2017-07-12 14:47:36 +02:00
|
|
|
${HEADER_DIR}/internal/catch_leak_detector.cpp
|
2017-07-20 00:27:28 +02:00
|
|
|
${HEADER_DIR}/internal/catch_matchers.cpp
|
2017-11-10 18:14:42 +01:00
|
|
|
${HEADER_DIR}/internal/catch_matchers_floating.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_matchers_string.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_message.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_registry_hub.cpp
|
2017-07-19 10:13:47 +02:00
|
|
|
${HEADER_DIR}/internal/catch_interfaces_reporter.cpp
|
2017-08-30 15:32:44 +02:00
|
|
|
${HEADER_DIR}/internal/catch_random_number_generator.cpp
|
2017-09-07 16:51:33 +02:00
|
|
|
${HEADER_DIR}/internal/catch_reporter_registry.cpp
|
2017-07-12 16:07:10 +02:00
|
|
|
${HEADER_DIR}/internal/catch_result_type.cpp
|
2017-07-15 16:48:21 +02:00
|
|
|
${HEADER_DIR}/internal/catch_run_context.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_section.cpp
|
2017-08-01 17:51:32 +02:00
|
|
|
${HEADER_DIR}/internal/catch_section_info.cpp
|
2017-08-31 10:31:52 +02:00
|
|
|
${HEADER_DIR}/internal/catch_session.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_startup_exception_registry.cpp
|
2017-08-10 11:45:05 +02:00
|
|
|
${HEADER_DIR}/internal/catch_stream.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_stringref.cpp
|
2017-07-25 21:57:35 +02:00
|
|
|
${HEADER_DIR}/internal/catch_string_manip.cpp
|
2017-07-25 22:13:14 +02:00
|
|
|
${HEADER_DIR}/internal/catch_tag_alias.cpp
|
2017-07-27 11:55:30 +02:00
|
|
|
${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_tag_alias_registry.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_test_case_info.cpp
|
2017-07-25 22:41:35 +02:00
|
|
|
${HEADER_DIR}/internal/catch_test_case_registry_impl.cpp
|
2017-07-19 10:13:47 +02:00
|
|
|
${HEADER_DIR}/internal/catch_test_case_tracker.cpp
|
2017-07-25 22:41:35 +02:00
|
|
|
${HEADER_DIR}/internal/catch_test_registry.cpp
|
2017-07-19 10:13:47 +02:00
|
|
|
${HEADER_DIR}/internal/catch_test_spec.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_test_spec_parser.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_timer.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_tostring.cpp
|
2017-07-19 10:13:47 +02:00
|
|
|
${HEADER_DIR}/internal/catch_totals.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
${HEADER_DIR}/internal/catch_version.cpp
|
2017-07-19 10:13:47 +02:00
|
|
|
${HEADER_DIR}/internal/catch_wildcard_pattern.cpp
|
|
|
|
${HEADER_DIR}/internal/catch_xmlwriter.cpp
|
2017-07-06 22:28:42 +02:00
|
|
|
)
|
|
|
|
set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS})
|
|
|
|
CheckFileList(INTERNAL_FILES ${HEADER_DIR}/internal)
|
2017-01-15 22:07:36 +01:00
|
|
|
|
|
|
|
# Please keep these ordered alphabetically
|
|
|
|
set(REPORTER_HEADERS
|
2017-02-22 11:17:25 +01:00
|
|
|
${HEADER_DIR}/reporters/catch_reporter_automake.hpp
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/reporters/catch_reporter_bases.hpp
|
2017-11-14 16:04:11 +01:00
|
|
|
${HEADER_DIR}/reporters/catch_reporter_compact.h
|
2017-11-14 20:42:58 +01:00
|
|
|
${HEADER_DIR}/reporters/catch_reporter_console.h
|
2017-11-14 17:12:51 +01:00
|
|
|
${HEADER_DIR}/reporters/catch_reporter_junit.h
|
2017-07-19 10:13:47 +02:00
|
|
|
${HEADER_DIR}/reporters/catch_reporter_multi.h
|
2017-02-22 13:28:13 +01:00
|
|
|
${HEADER_DIR}/reporters/catch_reporter_tap.hpp
|
2017-01-06 17:59:18 +01:00
|
|
|
${HEADER_DIR}/reporters/catch_reporter_teamcity.hpp
|
2017-11-14 17:56:27 +01:00
|
|
|
${HEADER_DIR}/reporters/catch_reporter_xml.h
|
2017-01-06 17:59:18 +01:00
|
|
|
)
|
2017-07-10 11:33:18 +02:00
|
|
|
set(REPORTER_SOURCES
|
|
|
|
${HEADER_DIR}/reporters/catch_reporter_bases.cpp
|
|
|
|
${HEADER_DIR}/reporters/catch_reporter_compact.cpp
|
|
|
|
${HEADER_DIR}/reporters/catch_reporter_console.cpp
|
|
|
|
${HEADER_DIR}/reporters/catch_reporter_junit.cpp
|
|
|
|
${HEADER_DIR}/reporters/catch_reporter_multi.cpp
|
|
|
|
${HEADER_DIR}/reporters/catch_reporter_xml.cpp
|
|
|
|
)
|
|
|
|
set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES})
|
|
|
|
CheckFileList(REPORTER_FILES ${HEADER_DIR}/reporters)
|
2017-01-15 22:07:36 +01:00
|
|
|
|
|
|
|
# Specify the headers, too, so CLion recognises them as project files
|
|
|
|
set(HEADERS
|
|
|
|
${TOP_LEVEL_HEADERS}
|
|
|
|
${EXTERNAL_HEADERS}
|
|
|
|
${INTERNAL_HEADERS}
|
|
|
|
${REPORTER_HEADERS}
|
|
|
|
)
|
|
|
|
|
2017-01-12 12:54:53 +01:00
|
|
|
# Provide some groupings for IDEs
|
2017-01-09 17:27:06 +01:00
|
|
|
SOURCE_GROUP("Tests" FILES ${TEST_SOURCES})
|
2017-07-06 22:28:42 +02:00
|
|
|
SOURCE_GROUP("Surrogates" FILES ${SURROGATE_SOURCES})
|
2017-01-09 17:27:06 +01:00
|
|
|
|
2013-08-05 12:40:33 +02:00
|
|
|
|
2017-04-28 20:27:10 +02:00
|
|
|
# Projects consuming Catch via ExternalProject_Add might want to use install step
|
|
|
|
# without building all of our selftests.
|
2018-01-18 00:01:27 +01:00
|
|
|
|
|
|
|
if(DEFINED NO_SELFTEST)
|
|
|
|
message(DEPRECATION "*** CMake option NO_SELFTEST is deprecated; use BUILD_TESTING instead")
|
|
|
|
if (NO_SELFTEST)
|
|
|
|
set(BUILD_TESTING OFF CACHE BOOL "Disable Catch2 internal testsuite" FORCE)
|
|
|
|
else()
|
|
|
|
set(BUILD_TESTING ON CACHE BOOL "Disable Catch2 internal testsuite" FORCE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(CTest)
|
|
|
|
|
|
|
|
if (BUILD_TESTING AND NOT_SUBPROJECT)
|
2017-07-10 11:33:18 +02:00
|
|
|
add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${REPORTER_SOURCES} ${SURROGATE_SOURCES} ${HEADERS})
|
2017-11-04 19:19:48 +01:00
|
|
|
target_include_directories(SelfTest PRIVATE ${HEADER_DIR})
|
2017-04-28 20:27:10 +02:00
|
|
|
|
2017-11-05 13:11:00 +01:00
|
|
|
if(USE_CPP14)
|
|
|
|
message(STATUS "Enabling C++14")
|
|
|
|
set_property(TARGET SelfTest PROPERTY CXX_STANDARD 14)
|
|
|
|
else()
|
|
|
|
message(STATUS "Enabling C++11")
|
|
|
|
set_property(TARGET SelfTest PROPERTY CXX_STANDARD 11)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_property(TARGET SelfTest PROPERTY CXX_STANDARD_REQUIRED ON)
|
|
|
|
set_property(TARGET SelfTest PROPERTY CXX_EXTENSIONS OFF)
|
|
|
|
|
2017-11-25 16:58:29 +01:00
|
|
|
if (ENABLE_COVERAGE)
|
2017-12-02 14:46:28 +01:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
|
|
|
find_package(codecov)
|
2017-11-25 16:58:29 +01:00
|
|
|
add_coverage(SelfTest)
|
2017-12-25 19:38:51 +01:00
|
|
|
list(APPEND LCOV_REMOVE_PATTERNS "'/usr/*'")
|
2017-11-25 16:58:29 +01:00
|
|
|
coverage_evaluate()
|
|
|
|
endif()
|
2017-11-05 13:11:00 +01:00
|
|
|
|
2017-04-28 20:27:10 +02:00
|
|
|
# Add desired warnings
|
|
|
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
|
2018-01-14 18:14:11 +01:00
|
|
|
target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code )
|
|
|
|
if (NOT DISABLE_WERROR)
|
|
|
|
target_compile_options( SelfTest PRIVATE -Werror)
|
|
|
|
endif()
|
2017-09-07 16:51:33 +02:00
|
|
|
endif()
|
|
|
|
# Clang specific warning go here
|
|
|
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
|
|
|
# Actually keep these
|
|
|
|
target_compile_options( SelfTest PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn )
|
2017-04-28 20:27:10 +02:00
|
|
|
endif()
|
|
|
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
|
2018-01-02 11:18:35 +01:00
|
|
|
STRING(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # override default warning level
|
2018-01-14 18:14:11 +01:00
|
|
|
target_compile_options( SelfTest PRIVATE /w44265 /w44061 /w44062 )
|
|
|
|
if (NOT DISABLE_WERROR)
|
|
|
|
target_compile_options( SelfTest PRIVATE /WX)
|
|
|
|
endif()
|
2017-04-28 20:27:10 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
# configure unit tests via CTest
|
2017-12-03 13:03:52 +01:00
|
|
|
include(CTest)
|
2017-11-05 12:46:04 +01:00
|
|
|
add_test(NAME RunTests COMMAND $<TARGET_FILE:SelfTest>)
|
2017-01-31 17:37:27 +01:00
|
|
|
|
2017-11-26 21:10:52 +01:00
|
|
|
add_test(NAME ListTests COMMAND $<TARGET_FILE:SelfTest> --list-tests --verbosity high)
|
2017-04-28 20:27:10 +02:00
|
|
|
set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases")
|
2017-01-31 17:37:27 +01:00
|
|
|
|
2017-11-05 12:46:04 +01:00
|
|
|
add_test(NAME ListTags COMMAND $<TARGET_FILE:SelfTest> --list-tags)
|
2017-04-28 20:27:10 +02:00
|
|
|
set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")
|
2013-10-24 03:57:46 +02:00
|
|
|
|
2017-11-26 21:10:52 +01:00
|
|
|
add_test(NAME ListReporters COMMAND $<TARGET_FILE:SelfTest> --list-reporters)
|
|
|
|
set_tests_properties(ListReporters PROPERTIES PASS_REGULAR_EXPRESSION "Available reporters:")
|
|
|
|
|
|
|
|
add_test(NAME ListTestNamesOnly COMMAND $<TARGET_FILE:SelfTest> --list-test-names-only)
|
|
|
|
set_tests_properties(ListTestNamesOnly PROPERTIES PASS_REGULAR_EXPRESSION "Regex string matcher")
|
|
|
|
|
|
|
|
|
2017-12-03 13:03:52 +01:00
|
|
|
|
2017-09-01 20:28:49 +02:00
|
|
|
# AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable
|
2017-09-01 19:12:15 +02:00
|
|
|
add_test(NAME ApprovalTests COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
|
2017-08-31 12:00:35 +02:00
|
|
|
set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed")
|
2017-11-26 21:10:52 +01:00
|
|
|
|
2017-11-05 12:46:04 +01:00
|
|
|
if (USE_VALGRIND)
|
|
|
|
add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>)
|
2017-11-26 21:10:52 +01:00
|
|
|
add_test(NAME ValgrindListTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tests --verbosity high)
|
2017-11-05 12:46:04 +01:00
|
|
|
set_tests_properties(ValgrindListTests PROPERTIES PASS_REGULAR_EXPRESSION "definitely lost: 0 bytes in 0 blocks")
|
|
|
|
add_test(NAME ValgrindListTags COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tags)
|
|
|
|
set_tests_properties(ValgrindListTags PROPERTIES PASS_REGULAR_EXPRESSION "definitely lost: 0 bytes in 0 blocks")
|
|
|
|
endif()
|
2017-11-26 21:10:52 +01:00
|
|
|
|
2017-04-28 20:27:10 +02:00
|
|
|
endif() # !NO_SELFTEST
|
2013-10-24 03:57:46 +02:00
|
|
|
|
2017-01-31 20:22:45 +01:00
|
|
|
|
2017-11-05 09:15:22 +01:00
|
|
|
if(BUILD_EXAMPLES)
|
|
|
|
add_subdirectory(examples)
|
|
|
|
endif()
|
|
|
|
|
2018-01-18 00:01:27 +01:00
|
|
|
install(DIRECTORY "single_include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/catch")
|
2017-10-12 21:42:09 +02:00
|
|
|
|
|
|
|
## Provide some pkg-config integration
|
|
|
|
# Don't bother on Windows
|
|
|
|
if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
|
|
|
|
|
|
|
|
set(PKGCONFIG_INSTALL_DIR
|
2018-01-18 00:01:27 +01:00
|
|
|
"${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
|
2017-10-12 21:42:09 +02:00
|
|
|
CACHE PATH "Path where catch.pc is installed"
|
|
|
|
)
|
|
|
|
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/catch.pc.in ${CMAKE_CURRENT_BINARY_DIR}/catch.pc @ONLY)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catch.pc DESTINATION ${PKGCONFIG_INSTALL_DIR})
|
|
|
|
|
|
|
|
endif()
|