From a6a16d64f3b250aebbc560535fe155a4d719fb8b Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 7 Feb 2021 01:10:24 +0100 Subject: [PATCH] final cleanup add some notes to not install tcov od test builds --- CMakeLists.txt | 13 +++++++------ test/CMakeLists.txt | 6 ++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c07d874..3d49118 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,9 +38,9 @@ CPMAddPackage( VERSION 1.4 ) -# NOTE: If fmt is not imported, this is needed to prevent: -# CMake Error: install(EXPORT "GreeterTargets" ...) includes target -# "Greeter" which requires target "fmt" that is not in any export set. +# NOTE: If fmt is not imported, this is needed to prevent: CMake Error: install(EXPORT +# "GreeterTargets" ...) includes target "Greeter" which requires target "fmt" that is not in any +# export set. option(FMT_INSTALL "needed!" YES) CPMAddPackage( @@ -67,12 +67,13 @@ target_compile_features(Greeter PUBLIC cxx_std_17) target_sources(Greeter PRIVATE ${headers} ${sources}) # being a cross-platform target, we enforce standards conformance on MSVC -# this should not exported on UNIX! CK -target_compile_options(Greeter PUBLIC "$<$:/permissive->") +if(MSVC) + target_compile_options(Greeter PUBLIC /permissive) +endif() # Link dependencies (if required) target_link_libraries(Greeter PRIVATE fmt::fmt-header-only) -#XXX target_link_libraries(Greeter PUBLIC fmt::fmt) +# XXX target_link_libraries(Greeter PUBLIC fmt::fmt) target_include_directories( Greeter PUBLIC $ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2d3bed3..0666dc4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -44,6 +44,7 @@ target_compile_features(GreeterTests PUBLIC cxx_std_17) # enable compiler warnings if(NOT TEST_INSTALLED_VERSION) + # NOTE: with this options the target should not installed! CK if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") target_compile_options(Greeter PRIVATE -Wall -Wpedantic -Wextra -Werror) elseif(MSVC) @@ -65,7 +66,8 @@ add_test(NAME GreeterTests COMMAND GreeterTests --success=false) # ---- code coverage ---- +# NOTE: with this options the target should not installed! CK if(ENABLE_TEST_COVERAGE AND NOT TEST_INSTALLED_VERSION) - target_compile_options(Greeter PRIVATE -O0 -g -fprofile-arcs -ftest-coverage) - target_link_options(Greeter PRIVATE -fprofile-arcs -ftest-coverage) + target_compile_options(Greeter PUBLIC -O0 -g -fprofile-arcs -ftest-coverage) + target_link_options(Greeter PUBLIC -fprofile-arcs -ftest-coverage) endif()