Fix coverage flags
- moved coverage flags within the src directory - scoped the coverage flags to current project Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
This commit is contained in:
parent
51d8c1dc80
commit
5af49cd72e
@ -69,19 +69,6 @@ endif ()
|
||||
# Enable cmake's BUILD_SHARED_LIBS
|
||||
set(BUILD_SHARED_LIBS ${nlohmann_json_schema_validator_SHARED_LIBS})
|
||||
|
||||
if (JSON_VALIDATOR_TEST_COVERAGE)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
||||
else ()
|
||||
message(WARNING
|
||||
"JsonValidator: Other toolchain coverage flags unknown.\n"
|
||||
"Using --coverage as default")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#[==============================================================================================[
|
||||
# External packages #
|
||||
]==============================================================================================]
|
||||
|
||||
@ -32,6 +32,16 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
|
||||
-Wall -Wextra -Wshadow)
|
||||
endif ()
|
||||
|
||||
if (JSON_VALIDATOR_TEST_COVERAGE)
|
||||
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "(Clang|GNU)")
|
||||
message(WARNING
|
||||
"Coverage flags not known for: ${CMAKE_CXX_COMPILER_ID}.\n"
|
||||
"Using --coverage as default")
|
||||
endif ()
|
||||
target_compile_options(nlohmann_json_schema_validator PRIVATE --coverage)
|
||||
target_link_options(nlohmann_json_schema_validator PUBLIC --coverage)
|
||||
endif ()
|
||||
|
||||
# TODO: gcc support for <4.9 should be removed
|
||||
# regex with boost if gcc < 4.9 - default is std::regex
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user