1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-31 22:21:13 +02:00

final cleanup

add some notes to not install tcov od test builds
This commit is contained in:
ClausKlein 2021-02-07 01:10:24 +01:00
parent 3c55643690
commit a6a16d64f3
2 changed files with 11 additions and 8 deletions

View file

@ -38,9 +38,9 @@ CPMAddPackage(
VERSION 1.4 VERSION 1.4
) )
# NOTE: If fmt is not imported, this is needed to prevent: # NOTE: If fmt is not imported, this is needed to prevent: CMake Error: install(EXPORT
# CMake Error: install(EXPORT "GreeterTargets" ...) includes target # "GreeterTargets" ...) includes target "Greeter" which requires target "fmt" that is not in any
# "Greeter" which requires target "fmt" that is not in any export set. # export set.
option(FMT_INSTALL "needed!" YES) option(FMT_INSTALL "needed!" YES)
CPMAddPackage( CPMAddPackage(
@ -67,12 +67,13 @@ target_compile_features(Greeter PUBLIC cxx_std_17)
target_sources(Greeter PRIVATE ${headers} ${sources}) target_sources(Greeter PRIVATE ${headers} ${sources})
# being a cross-platform target, we enforce standards conformance on MSVC # being a cross-platform target, we enforce standards conformance on MSVC
# this should not exported on UNIX! CK if(MSVC)
target_compile_options(Greeter PUBLIC "$<$<CXX_COMPILER_ID:MSVC>:/permissive->") target_compile_options(Greeter PUBLIC /permissive)
endif()
# Link dependencies (if required) # Link dependencies (if required)
target_link_libraries(Greeter PRIVATE fmt::fmt-header-only) 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( target_include_directories(
Greeter PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> Greeter PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>

View file

@ -44,6 +44,7 @@ target_compile_features(GreeterTests PUBLIC cxx_std_17)
# enable compiler warnings # enable compiler warnings
if(NOT TEST_INSTALLED_VERSION) 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") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(Greeter PRIVATE -Wall -Wpedantic -Wextra -Werror) target_compile_options(Greeter PRIVATE -Wall -Wpedantic -Wextra -Werror)
elseif(MSVC) elseif(MSVC)
@ -65,7 +66,8 @@ add_test(NAME GreeterTests COMMAND GreeterTests --success=false)
# ---- code coverage ---- # ---- code coverage ----
# NOTE: with this options the target should not installed! CK
if(ENABLE_TEST_COVERAGE AND NOT TEST_INSTALLED_VERSION) if(ENABLE_TEST_COVERAGE AND NOT TEST_INSTALLED_VERSION)
target_compile_options(Greeter PRIVATE -O0 -g -fprofile-arcs -ftest-coverage) target_compile_options(Greeter PUBLIC -O0 -g -fprofile-arcs -ftest-coverage)
target_link_options(Greeter PRIVATE -fprofile-arcs -ftest-coverage) target_link_options(Greeter PUBLIC -fprofile-arcs -ftest-coverage)
endif() endif()