Move coverage option to test subproject
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
This commit is contained in:
parent
3a24ab3c0c
commit
833a836c1c
@ -52,8 +52,6 @@ else ()
|
|||||||
option(JSON_VALIDATOR_BUILD_EXAMPLES "JsonValidator: Build examples" ${PROJECT_IS_TOP_LEVEL})
|
option(JSON_VALIDATOR_BUILD_EXAMPLES "JsonValidator: Build examples" ${PROJECT_IS_TOP_LEVEL})
|
||||||
endif ()
|
endif ()
|
||||||
option(JSON_VALIDATOR_SHARED_LIBS "JsonValidator: Build as shared library" ${PROJECT_IS_TOP_LEVEL})
|
option(JSON_VALIDATOR_SHARED_LIBS "JsonValidator: Build as shared library" ${PROJECT_IS_TOP_LEVEL})
|
||||||
cmake_dependent_option(JSON_VALIDATOR_TEST_COVERAGE "JsonValidator: Build with test coverage" OFF "JSON_VALIDATOR_BUILD_TESTS" OFF)
|
|
||||||
mark_as_advanced(JSON_VALIDATOR_TEST_COVERAGE)
|
|
||||||
# Get a default JSON_FETCH_VERSION from environment variables to workaround the CI
|
# Get a default JSON_FETCH_VERSION from environment variables to workaround the CI
|
||||||
if (DEFINED ENV{NLOHMANN_JSON_VERSION})
|
if (DEFINED ENV{NLOHMANN_JSON_VERSION})
|
||||||
set(JSON_FETCH_VERSION_DEFAULT $ENV{NLOHMANN_JSON_VERSION})
|
set(JSON_FETCH_VERSION_DEFAULT $ENV{NLOHMANN_JSON_VERSION})
|
||||||
|
|||||||
@ -32,16 +32,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
|
|||||||
-Wall -Wextra -Wshadow)
|
-Wall -Wextra -Wshadow)
|
||||||
endif ()
|
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
|
# TODO: gcc support for <4.9 should be removed
|
||||||
# regex with boost if gcc < 4.9 - default is std::regex
|
# regex with boost if gcc < 4.9 - default is std::regex
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
|||||||
@ -13,12 +13,26 @@ project(nlohmann_json_schema_validator_test
|
|||||||
# Options #
|
# Options #
|
||||||
]==============================================================================================]
|
]==============================================================================================]
|
||||||
|
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
cmake_dependent_option(JSON_VALIDATOR_TEST_COVERAGE "JsonValidator: Build with test coverage" OFF "nlohmann_json_schema_validator_IS_TOP_LEVEL" OFF)
|
||||||
|
mark_as_advanced(JSON_VALIDATOR_TEST_COVERAGE)
|
||||||
|
|
||||||
#[==============================================================================================[
|
#[==============================================================================================[
|
||||||
# Project configuration #
|
# Project configuration #
|
||||||
]==============================================================================================]
|
]==============================================================================================]
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
|
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 ()
|
||||||
|
|
||||||
#[==============================================================================================[
|
#[==============================================================================================[
|
||||||
# External packages #
|
# External packages #
|
||||||
]==============================================================================================]
|
]==============================================================================================]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user