diff options
| author | Martin Hořeňovský | 2019-12-16 22:33:56 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-12-16 22:33:56 +0100 |
| commit | add7068f21cfcc6782c661a3d6ee39dc9372d98b (patch) | |
| tree | bed16bc5f1462ae1ecbf7804ebd2e3ce2edb4c0a /src | |
| parent | ebeeaaeec673ebab87d5ef0ba3aa63b2791e3406 (diff) | |
| download | catch3-add7068f21cfcc6782c661a3d6ee39dc9372d98b.tar.gz | |
Fixup installation
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eeef8f31..89f089cc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,6 +29,7 @@ set(BENCHMARK_SOURCES SOURCE_GROUP("benchmark" FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES}) set(INTERNAL_HEADERS + ${SOURCES_DIR}/catch.hpp ${SOURCES_DIR}/catch_approx.h ${SOURCES_DIR}/catch_assertionhandler.h ${SOURCES_DIR}/catch_assertioninfo.h @@ -224,12 +225,69 @@ add_library(Catch2 STATIC ${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 + cxx_alignas + cxx_alignof + cxx_attributes + cxx_auto_type + cxx_constexpr + cxx_defaulted_functions + cxx_deleted_functions + cxx_final + cxx_lambdas + cxx_noexcept + cxx_override + cxx_range_for + cxx_rvalue_references + cxx_static_assert + cxx_strong_enums + cxx_trailing_return_types + cxx_unicode_literals + cxx_user_literals + cxx_variable_templates + cxx_variadic_macros +) + +if (NOT_SUBPROJECT) + # create and install an export set for catch target as Catch2::Catch + install( + TARGETS + Catch2 + EXPORT + Catch2Targets + DESTINATION + ${CMAKE_INSTALL_LIBDIR} + ) + + + install( + EXPORT + Catch2Targets + NAMESPACE + Catch2:: + DESTINATION + ${CATCH_CMAKE_CONFIG_DESTINATION} + ) + # This installs 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 # compilation flags. They can link against this target to recompile all # the sources into the binary. |