diff options
| author | Martin Hořeňovský | 2019-12-18 17:25:04 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-12-18 17:25:04 +0100 |
| commit | 1cc05122d7a97723d8081cd84b6b46abdeab4058 (patch) | |
| tree | a0a7e1c0cee5071e52aca34de4a2fe03ebada937 /src | |
| parent | add7068f21cfcc6782c661a3d6ee39dc9372d98b (diff) | |
| download | catch3-1cc05122d7a97723d8081cd84b6b46abdeab4058.tar.gz | |
Add Catch2Main CMake target that contains test main
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 89f089cc..7f2811dc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -224,23 +224,15 @@ add_library(Catch2 STATIC ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES} ) - -# provide a namespaced alias for clients to 'link' against if catch is included as a sub-project add_library(Catch2::Catch2 ALIAS Catch2) + if (ANDROID) target_link_libraries(Catch2 INTERFACE log) endif() - -target_include_directories(Catch2 - PUBLIC - $<BUILD_INTERFACE:${SOURCES_DIR}/..> - $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> -) - # depend on bunch of C++11 and C++14 features to have C++14 enabled by default target_compile_features(Catch2 - INTERFACE + PUBLIC cxx_alignas cxx_alignof cxx_attributes @@ -263,11 +255,27 @@ target_compile_features(Catch2 cxx_variadic_macros ) +target_include_directories(Catch2 + PUBLIC + $<BUILD_INTERFACE:${SOURCES_DIR}/..> + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> +) + + +add_library(Catch2Main STATIC + ${SOURCES_DIR}/catch_main.cpp +) +add_library(Catch2::Catch2Main ALIAS Catch2Main) +target_link_libraries(Catch2Main INTERFACE Catch2) + + + if (NOT_SUBPROJECT) # create and install an export set for catch target as Catch2::Catch install( TARGETS Catch2 + Catch2Main EXPORT Catch2Targets DESTINATION @@ -283,9 +291,8 @@ if (NOT_SUBPROJECT) DESTINATION ${CATCH_CMAKE_CONFIG_DESTINATION} ) - # This installs the headers + # Install the headers install(DIRECTORY ${SOURCES_DIR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h*") - # TODO: Also install the helper main endif() # Some tests require a full recompilation of Catch2 lib with different |