WIP: CMake changes to build static lib + tests separately

This commit is contained in:
Martin Hořeňovský 2019-11-30 17:41:41 +01:00
parent 443fa0fc88
commit e341b11467
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
3 changed files with 436 additions and 211 deletions

View File

@ -23,211 +23,214 @@ include(GNUInstallDirs)
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
include(CTest) include(CTest)
option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF) # Basic paths
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF)
option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
option(CATCH_INSTALL_HELPERS "Install contrib alongside library" ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# define some folders
set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SOURCES_DIR ${CATCH_DIR}/src/catch2)
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest) set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark) set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark)
set(HEADER_DIR ${CATCH_DIR}/include)
if(USE_WMAIN) add_subdirectory(src)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup") add_subdirectory(projects)
endif()
if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT) #option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
find_package(PythonInterp) #option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
if (NOT PYTHONINTERP_FOUND) #option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
message(FATAL_ERROR "Python not found, but required for tests") #option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF)
endif() #option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
add_subdirectory(projects) #option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
endif() #option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
#option(CATCH_INSTALL_HELPERS "Install contrib alongside library" ON)
if(CATCH_BUILD_EXAMPLES) #
add_subdirectory(examples) #
endif() #set_property(GLOBAL PROPERTY USE_FOLDERS ON)
#
if(CATCH_BUILD_EXTRA_TESTS) #if(USE_WMAIN)
add_subdirectory(projects/ExtraTests) # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
endif() #endif()
#
# add catch as a 'linkable' target #if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
add_library(Catch2 INTERFACE) # find_package(PythonInterp)
# if (NOT PYTHONINTERP_FOUND)
# message(FATAL_ERROR "Python not found, but required for tests")
# endif()
# depend on some obvious c++11 features so the dependency is transitively added dependents # add_subdirectory(projects)
target_compile_features(Catch2 #endif()
INTERFACE #
cxx_alignas #if(CATCH_BUILD_EXAMPLES)
cxx_alignof # add_subdirectory(examples)
cxx_attributes #endif()
cxx_auto_type #
cxx_constexpr #if(CATCH_BUILD_EXTRA_TESTS)
cxx_defaulted_functions # add_subdirectory(projects/ExtraTests)
cxx_deleted_functions #endif()
cxx_final #
cxx_lambdas ## add catch as a 'linkable' target
cxx_noexcept #add_library(Catch2 INTERFACE)
cxx_override #
cxx_range_for #
cxx_rvalue_references #
cxx_static_assert ## depend on some obvious c++11 features so the dependency is transitively added dependents
cxx_strong_enums #target_compile_features(Catch2
cxx_trailing_return_types # INTERFACE
cxx_unicode_literals # cxx_alignas
cxx_user_literals # cxx_alignof
cxx_variadic_macros # cxx_attributes
) # cxx_auto_type
# cxx_constexpr
target_include_directories(Catch2 # cxx_defaulted_functions
INTERFACE # cxx_deleted_functions
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/single_include> # cxx_final
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> # cxx_lambdas
) # cxx_noexcept
# cxx_override
if (ANDROID) # cxx_range_for
target_link_libraries(Catch2 INTERFACE log) # cxx_rvalue_references
endif() # cxx_static_assert
# cxx_strong_enums
# provide a namespaced alias for clients to 'link' against if catch is included as a sub-project # cxx_trailing_return_types
add_library(Catch2::Catch2 ALIAS Catch2) # cxx_unicode_literals
# cxx_user_literals
# Only perform the installation steps when Catch is not being used as # cxx_variadic_macros
# a subproject via `add_subdirectory`, or the destinations will break, #)
# see https://github.com/catchorg/Catch2/issues/1373 #
if (NOT_SUBPROJECT) #target_include_directories(Catch2
set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2") # INTERFACE
# $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/single_include>
configure_package_config_file( # $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
${CMAKE_CURRENT_LIST_DIR}/CMake/Catch2Config.cmake.in #)
${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake #
INSTALL_DESTINATION #if (ANDROID)
${CATCH_CMAKE_CONFIG_DESTINATION} # target_link_libraries(Catch2 INTERFACE log)
) #endif()
#
## provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
# create and install an export set for catch target as Catch2::Catch #add_library(Catch2::Catch2 ALIAS Catch2)
install( #
TARGETS ## Only perform the installation steps when Catch is not being used as
Catch2 ## a subproject via `add_subdirectory`, or the destinations will break,
EXPORT ## see https://github.com/catchorg/Catch2/issues/1373
Catch2Targets #if (NOT_SUBPROJECT)
DESTINATION # set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
${CMAKE_INSTALL_LIBDIR} #
) # configure_package_config_file(
# ${CMAKE_CURRENT_LIST_DIR}/CMake/Catch2Config.cmake.in
# ${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake
install( # INSTALL_DESTINATION
EXPORT # ${CATCH_CMAKE_CONFIG_DESTINATION}
Catch2Targets # )
NAMESPACE #
Catch2:: #
DESTINATION # # create and install an export set for catch target as Catch2::Catch
${CATCH_CMAKE_CONFIG_DESTINATION} # install(
) # TARGETS
# Catch2
# By default, FooConfigVersion is tied to architecture that it was # EXPORT
# generated on. Because Catch2 is header-only, it is arch-independent # Catch2Targets
# and thus Catch2ConfigVersion should not be tied to the architecture # DESTINATION
# it was generated on. # ${CMAKE_INSTALL_LIBDIR}
# # )
# CMake does not provide a direct customization point for this in #
# `write_basic_package_version_file`, but it can be accomplished #
# indirectly by temporarily redefining `CMAKE_SIZEOF_VOID_P` to an # install(
# empty string. Note that just undefining the variable could be # EXPORT
# insufficient in cases where the variable was already in CMake cache # Catch2Targets
set(CATCH2_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) # NAMESPACE
set(CMAKE_SIZEOF_VOID_P "") # Catch2::
write_basic_package_version_file( # DESTINATION
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake" # ${CATCH_CMAKE_CONFIG_DESTINATION}
COMPATIBILITY # )
SameMajorVersion #
) # # By default, FooConfigVersion is tied to architecture that it was
set(CMAKE_SIZEOF_VOID_P ${CATCH2_CMAKE_SIZEOF_VOID_P}) # # generated on. Because Catch2 is header-only, it is arch-independent
# # and thus Catch2ConfigVersion should not be tied to the architecture
install( # # it was generated on.
DIRECTORY # #
"single_include/" # # CMake does not provide a direct customization point for this in
DESTINATION # # `write_basic_package_version_file`, but it can be accomplished
"${CMAKE_INSTALL_INCLUDEDIR}" # # indirectly by temporarily redefining `CMAKE_SIZEOF_VOID_P` to an
) # # empty string. Note that just undefining the variable could be
# # insufficient in cases where the variable was already in CMake cache
install( # set(CATCH2_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
FILES # set(CMAKE_SIZEOF_VOID_P "")
"${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake" # write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake" # "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
DESTINATION # COMPATIBILITY
${CATCH_CMAKE_CONFIG_DESTINATION} # SameMajorVersion
) # )
# set(CMAKE_SIZEOF_VOID_P ${CATCH2_CMAKE_SIZEOF_VOID_P})
# Install documentation #
if(CATCH_INSTALL_DOCS) # install(
install( # DIRECTORY
DIRECTORY # "single_include/"
docs/ # DESTINATION
DESTINATION # "${CMAKE_INSTALL_INCLUDEDIR}"
"${CMAKE_INSTALL_DOCDIR}" # )
) #
endif() # install(
# FILES
if(CATCH_INSTALL_HELPERS) # "${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake"
# Install CMake scripts # "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
install( # DESTINATION
FILES # ${CATCH_CMAKE_CONFIG_DESTINATION}
"contrib/ParseAndAddCatchTests.cmake" # )
"contrib/Catch.cmake" #
"contrib/CatchAddTests.cmake" # # Install documentation
DESTINATION # if(CATCH_INSTALL_DOCS)
${CATCH_CMAKE_CONFIG_DESTINATION} # install(
) # DIRECTORY
# docs/
# Install debugger helpers # DESTINATION
install( # "${CMAKE_INSTALL_DOCDIR}"
FILES # )
"contrib/gdbinit" # endif()
"contrib/lldbinit" #
DESTINATION # if(CATCH_INSTALL_HELPERS)
${CMAKE_INSTALL_DATAROOTDIR}/Catch2 # # Install CMake scripts
) # install(
endif() # FILES
# "contrib/ParseAndAddCatchTests.cmake"
## Provide some pkg-config integration # "contrib/Catch.cmake"
set(PKGCONFIG_INSTALL_DIR # "contrib/CatchAddTests.cmake"
"${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig" # DESTINATION
CACHE PATH "Path where catch2.pc is installed" # ${CATCH_CMAKE_CONFIG_DESTINATION}
) # )
configure_file( #
${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2.pc.in # # Install debugger helpers
${CMAKE_CURRENT_BINARY_DIR}/catch2.pc # install(
@ONLY # FILES
) # "contrib/gdbinit"
install( # "contrib/lldbinit"
FILES # DESTINATION
"${CMAKE_CURRENT_BINARY_DIR}/catch2.pc" # ${CMAKE_INSTALL_DATAROOTDIR}/Catch2
DESTINATION # )
${PKGCONFIG_INSTALL_DIR} # endif()
) #
# ## Provide some pkg-config integration
# CPack/CMake started taking the package version from project version 3.12 # set(PKGCONFIG_INSTALL_DIR
# So we need to set the version manually for older CMake versions # "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
if(${CMAKE_VERSION} VERSION_LESS "3.12.0") # CACHE PATH "Path where catch2.pc is installed"
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) # )
endif() # configure_file(
# ${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2.pc.in
set(CPACK_PACKAGE_CONTACT "https://github.com/catchorg/Catch2/") # ${CMAKE_CURRENT_BINARY_DIR}/catch2.pc
# @ONLY
# )
include( CPack ) # install(
# FILES
endif(NOT_SUBPROJECT) # "${CMAKE_CURRENT_BINARY_DIR}/catch2.pc"
# DESTINATION
# ${PKGCONFIG_INSTALL_DIR}
# )
#
# # CPack/CMake started taking the package version from project version 3.12
# # So we need to set the version manually for older CMake versions
# if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
# set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
# endif()
#
# set(CPACK_PACKAGE_CONTACT "https://github.com/catchorg/Catch2/")
#
#
# include( CPack )
#
#endif(NOT_SUBPROJECT)

View File

@ -69,12 +69,6 @@ set(SURROGATE_SOURCES
CheckFileList(SURROGATE_SOURCES ${SELF_TEST_DIR}/SurrogateCpps) CheckFileList(SURROGATE_SOURCES ${SELF_TEST_DIR}/SurrogateCpps)
# Please keep these ordered alphabetically
set(TOP_LEVEL_HEADERS
${HEADER_DIR}/catch.hpp
)
CheckFileList(TOP_LEVEL_HEADERS ${HEADER_DIR})
# Please keep these ordered alphabetically # Please keep these ordered alphabetically
set(EXTERNAL_HEADERS set(EXTERNAL_HEADERS
${HEADER_DIR}/external/clara.hpp ${HEADER_DIR}/external/clara.hpp
@ -309,7 +303,8 @@ SOURCE_GROUP("Surrogates" FILES ${SURROGATE_SOURCES})
include(CTest) include(CTest)
add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${REPORTER_SOURCES} ${SURROGATE_SOURCES} ${HEADERS}) add_executable(SelfTest ${TEST_SOURCES})
target_link_libraries(SelfTest PRIVATE Catch2)
target_include_directories(SelfTest PRIVATE ${HEADER_DIR}) target_include_directories(SelfTest PRIVATE ${HEADER_DIR})
# It took CMake until 3.8 to abandon the doomed approach of enumerating # It took CMake until 3.8 to abandon the doomed approach of enumerating

227
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,227 @@
include(MiscFunctions)
# Please keep these ordered alphabetically
set(BENCHMARK_HEADERS
${SOURCES_DIR}/benchmark/catch_benchmark.hpp
${SOURCES_DIR}/benchmark/catch_chronometer.hpp
${SOURCES_DIR}/benchmark/catch_clock.hpp
${SOURCES_DIR}/benchmark/catch_constructor.hpp
${SOURCES_DIR}/benchmark/catch_environment.hpp
${SOURCES_DIR}/benchmark/catch_estimate.hpp
${SOURCES_DIR}/benchmark/catch_execution_plan.hpp
${SOURCES_DIR}/benchmark/catch_optimizer.hpp
${SOURCES_DIR}/benchmark/catch_outlier_classification.hpp
${SOURCES_DIR}/benchmark/catch_sample_analysis.hpp
${SOURCES_DIR}/benchmark/detail/catch_analyse.hpp
${SOURCES_DIR}/benchmark/detail/catch_benchmark_function.hpp
${SOURCES_DIR}/benchmark/detail/catch_complete_invoke.hpp
${SOURCES_DIR}/benchmark/detail/catch_estimate_clock.hpp
${SOURCES_DIR}/benchmark/detail/catch_measure.hpp
${SOURCES_DIR}/benchmark/detail/catch_repeat.hpp
${SOURCES_DIR}/benchmark/detail/catch_run_for_at_least.hpp
${SOURCES_DIR}/benchmark/detail/catch_stats.hpp
${SOURCES_DIR}/benchmark/detail/catch_timing.hpp
)
set(BENCHMARK_SOURCES
${SOURCES_DIR}/benchmark/detail/catch_stats.cpp
)
SOURCE_GROUP("benchmark" FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES})
set(INTERNAL_HEADERS
${SOURCES_DIR}/catch_approx.h
${SOURCES_DIR}/catch_assertionhandler.h
${SOURCES_DIR}/catch_assertioninfo.h
${SOURCES_DIR}/catch_assertionresult.h
${SOURCES_DIR}/catch_capture.hpp
${SOURCES_DIR}/catch_capture_matchers.h
${SOURCES_DIR}/catch_clara.h
${SOURCES_DIR}/catch_commandline.h
${SOURCES_DIR}/catch_common.h
${SOURCES_DIR}/catch_compiler_capabilities.h
${SOURCES_DIR}/catch_config.hpp
${SOURCES_DIR}/catch_console_colour.h
${SOURCES_DIR}/catch_context.h
${SOURCES_DIR}/catch_debug_console.h
${SOURCES_DIR}/catch_debugger.h
${SOURCES_DIR}/catch_decomposer.h
${SOURCES_DIR}/catch_default_main.hpp
${SOURCES_DIR}/catch_enforce.h
${SOURCES_DIR}/catch_enum_values_registry.h
${SOURCES_DIR}/catch_errno_guard.h
${SOURCES_DIR}/catch_exception_translator_registry.h
${SOURCES_DIR}/catch_external_interfaces.h
${SOURCES_DIR}/catch_fatal_condition.h
${SOURCES_DIR}/catch_generators.hpp
${SOURCES_DIR}/catch_generators_generic.hpp
${SOURCES_DIR}/catch_generators_specific.hpp
${SOURCES_DIR}/catch_impl.hpp
${SOURCES_DIR}/catch_interfaces_capture.h
${SOURCES_DIR}/catch_interfaces_config.h
${SOURCES_DIR}/catch_interfaces_enum_values_registry.h
${SOURCES_DIR}/catch_interfaces_exception.h
${SOURCES_DIR}/catch_interfaces_registry_hub.h
${SOURCES_DIR}/catch_interfaces_reporter.h
${SOURCES_DIR}/catch_interfaces_runner.h
${SOURCES_DIR}/catch_interfaces_tag_alias_registry.h
${SOURCES_DIR}/catch_interfaces_testcase.h
${SOURCES_DIR}/catch_leak_detector.h
${SOURCES_DIR}/catch_list.h
${SOURCES_DIR}/catch_matchers.h
${SOURCES_DIR}/catch_matchers_exception.hpp
${SOURCES_DIR}/catch_matchers_floating.h
${SOURCES_DIR}/catch_matchers_generic.hpp
${SOURCES_DIR}/catch_matchers_string.h
${SOURCES_DIR}/catch_matchers_vector.h
${SOURCES_DIR}/catch_message.h
${SOURCES_DIR}/catch_meta.hpp
${SOURCES_DIR}/catch_objc.hpp
${SOURCES_DIR}/catch_objc_arc.hpp
${SOURCES_DIR}/catch_option.hpp
${SOURCES_DIR}/catch_output_redirect.h
${SOURCES_DIR}/catch_platform.h
${SOURCES_DIR}/catch_polyfills.hpp
${SOURCES_DIR}/catch_preprocessor.hpp
${SOURCES_DIR}/catch_random_number_generator.h
${SOURCES_DIR}/catch_reenable_warnings.h
${SOURCES_DIR}/catch_reporter_registrars.hpp
${SOURCES_DIR}/catch_reporter_registry.h
${SOURCES_DIR}/catch_result_type.h
${SOURCES_DIR}/catch_run_context.h
${SOURCES_DIR}/catch_section.h
${SOURCES_DIR}/catch_section_info.h
${SOURCES_DIR}/catch_session.h
${SOURCES_DIR}/catch_singletons.hpp
${SOURCES_DIR}/catch_startup_exception_registry.h
${SOURCES_DIR}/catch_stream.h
${SOURCES_DIR}/catch_stringref.h
${SOURCES_DIR}/catch_string_manip.h
${SOURCES_DIR}/catch_suppress_warnings.h
${SOURCES_DIR}/catch_tag_alias.h
${SOURCES_DIR}/catch_tag_alias_autoregistrar.h
${SOURCES_DIR}/catch_tag_alias_registry.h
${SOURCES_DIR}/catch_test_case_info.h
${SOURCES_DIR}/catch_test_case_registry_impl.h
${SOURCES_DIR}/catch_test_case_tracker.h
${SOURCES_DIR}/catch_test_registry.h
${SOURCES_DIR}/catch_test_spec.h
${SOURCES_DIR}/catch_test_spec_parser.h
${SOURCES_DIR}/catch_text.h
${SOURCES_DIR}/catch_timer.h
${SOURCES_DIR}/catch_to_string.hpp
${SOURCES_DIR}/catch_tostring.h
${SOURCES_DIR}/catch_totals.h
${SOURCES_DIR}/catch_uncaught_exceptions.h
${SOURCES_DIR}/catch_user_interfaces.h
${SOURCES_DIR}/catch_version.h
${SOURCES_DIR}/catch_wildcard_pattern.h
${SOURCES_DIR}/catch_windows_h_proxy.h
${SOURCES_DIR}/catch_xmlwriter.h
)
set(IMPL_SOURCES
${SOURCES_DIR}/catch_approx.cpp
${SOURCES_DIR}/catch_assertionhandler.cpp
${SOURCES_DIR}/catch_assertionresult.cpp
${SOURCES_DIR}/catch_capture_matchers.cpp
${SOURCES_DIR}/catch_commandline.cpp
${SOURCES_DIR}/catch_common.cpp
${SOURCES_DIR}/catch_config.cpp
${SOURCES_DIR}/catch_console_colour.cpp
${SOURCES_DIR}/catch_context.cpp
${SOURCES_DIR}/catch_debug_console.cpp
${SOURCES_DIR}/catch_debugger.cpp
${SOURCES_DIR}/catch_decomposer.cpp
${SOURCES_DIR}/catch_enforce.cpp
${SOURCES_DIR}/catch_enum_values_registry.cpp
${SOURCES_DIR}/catch_errno_guard.cpp
${SOURCES_DIR}/catch_exception_translator_registry.cpp
${SOURCES_DIR}/catch_fatal_condition.cpp
${SOURCES_DIR}/catch_generators.cpp
${SOURCES_DIR}/catch_interfaces_capture.cpp
${SOURCES_DIR}/catch_interfaces_config.cpp
${SOURCES_DIR}/catch_interfaces_exception.cpp
${SOURCES_DIR}/catch_interfaces_generatortracker.h
${SOURCES_DIR}/catch_interfaces_registry_hub.cpp
${SOURCES_DIR}/catch_interfaces_runner.cpp
${SOURCES_DIR}/catch_interfaces_testcase.cpp
${SOURCES_DIR}/catch_list.cpp
${SOURCES_DIR}/catch_leak_detector.cpp
${SOURCES_DIR}/catch_matchers.cpp
${SOURCES_DIR}/catch_matchers_exception.cpp
${SOURCES_DIR}/catch_matchers_floating.cpp
${SOURCES_DIR}/catch_matchers_generic.cpp
${SOURCES_DIR}/catch_matchers_string.cpp
${SOURCES_DIR}/catch_message.cpp
${SOURCES_DIR}/catch_output_redirect.cpp
${SOURCES_DIR}/catch_registry_hub.cpp
${SOURCES_DIR}/catch_interfaces_reporter.cpp
${SOURCES_DIR}/catch_polyfills.cpp
${SOURCES_DIR}/catch_random_number_generator.cpp
${SOURCES_DIR}/catch_reporter_registry.cpp
${SOURCES_DIR}/catch_result_type.cpp
${SOURCES_DIR}/catch_run_context.cpp
${SOURCES_DIR}/catch_section.cpp
${SOURCES_DIR}/catch_session.cpp
${SOURCES_DIR}/catch_singletons.cpp
${SOURCES_DIR}/catch_startup_exception_registry.cpp
${SOURCES_DIR}/catch_stream.cpp
${SOURCES_DIR}/catch_stringref.cpp
${SOURCES_DIR}/catch_string_manip.cpp
${SOURCES_DIR}/catch_tag_alias.cpp
${SOURCES_DIR}/catch_tag_alias_autoregistrar.cpp
${SOURCES_DIR}/catch_tag_alias_registry.cpp
${SOURCES_DIR}/catch_test_case_info.cpp
${SOURCES_DIR}/catch_test_case_registry_impl.cpp
${SOURCES_DIR}/catch_test_case_tracker.cpp
${SOURCES_DIR}/catch_test_registry.cpp
${SOURCES_DIR}/catch_test_spec.cpp
${SOURCES_DIR}/catch_test_spec_parser.cpp
${SOURCES_DIR}/catch_timer.cpp
${SOURCES_DIR}/catch_tostring.cpp
${SOURCES_DIR}/catch_totals.cpp
${SOURCES_DIR}/catch_uncaught_exceptions.cpp
${SOURCES_DIR}/catch_version.cpp
${SOURCES_DIR}/catch_wildcard_pattern.cpp
${SOURCES_DIR}/catch_xmlwriter.cpp
)
set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS})
CheckFileList(INTERNAL_FILES ${SOURCES_DIR}/internal)
# Please keep these ordered alphabetically
set(REPORTER_HEADERS
${SOURCES_DIR}/reporters/catch_reporter_automake.hpp
${SOURCES_DIR}/reporters/catch_reporter_bases.hpp
${SOURCES_DIR}/reporters/catch_reporter_compact.h
${SOURCES_DIR}/reporters/catch_reporter_console.h
${SOURCES_DIR}/reporters/catch_reporter_junit.h
${SOURCES_DIR}/reporters/catch_reporter_listening.h
${SOURCES_DIR}/reporters/catch_reporter_tap.hpp
${SOURCES_DIR}/reporters/catch_reporter_teamcity.hpp
${SOURCES_DIR}/reporters/catch_reporter_xml.h
${SOURCES_DIR}/reporters/catch_reporter_sonarqube.hpp
)
set(REPORTER_SOURCES
${SOURCES_DIR}/reporters/catch_reporter_bases.cpp
${SOURCES_DIR}/reporters/catch_reporter_compact.cpp
${SOURCES_DIR}/reporters/catch_reporter_console.cpp
${SOURCES_DIR}/reporters/catch_reporter_junit.cpp
${SOURCES_DIR}/reporters/catch_reporter_listening.cpp
${SOURCES_DIR}/reporters/catch_reporter_xml.cpp
)
set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES})
CheckFileList(REPORTER_FILES ${SOURCES_DIR}/reporters)
# Fixme: STATIC because for dynamic, we would need to handle visibility
# and I don't want to do the annotations right now
add_library(Catch2 STATIC
${REPORTER_FILES}
${INTERNAL_FILES}
${BENCHMARK_HEADERS}
${BENCHMARK_SOURCES}
)
target_include_directories(Catch2
PUBLIC
$<BUILD_INTERFACE:${SOURCES_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)