mirror of
https://github.com/TheLartians/ModernCppStarter.git
synced 2025-08-30 21:51:12 +02:00
final cleanup
add some notes to not install tcov od test builds
This commit is contained in:
parent
3c55643690
commit
a6a16d64f3
2 changed files with 11 additions and 8 deletions
|
@ -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 "$<$<CXX_COMPILER_ID:MSVC>:/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 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue