Skip to content
Snippets Groups Projects
Commit a103192c authored by Daniel Hornung's avatar Daniel Hornung
Browse files

ENH: Make code coverage optional and depend on available libraries.

parent 657d62bf
No related branches found
No related tags found
2 merge requests!33Release 0.1,!30Debug build
Pipeline #14807 failed
...@@ -136,6 +136,18 @@ ...@@ -136,6 +136,18 @@
include(CMakeParseArguments) include(CMakeParseArguments)
option(CODE_COVERAGE_VERBOSE "Verbose information" FALSE) option(CODE_COVERAGE_VERBOSE "Verbose information" FALSE)
option(SKIP_CODE_COVERAGE "Skip code coverage" OFF)
if (SKIP_CODE_COVERAGE)
return()
endif()
find_library(covlib NAMES gcov lcov)
message(STATUS "covlib: >${covlib}<")
if (${covlib} STREQUAL "covlib-NOTFOUND")
message(Warning "lcov or gcov libraries not found, skipping code coverage.")
return()
endif()
# Check prereqs # Check prereqs
find_program( GCOV_PATH gcov ) find_program( GCOV_PATH gcov )
......
...@@ -88,7 +88,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/caosdb_test_utility.h.in ...@@ -88,7 +88,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/caosdb_test_utility.h.in
include(CodeCoverage) include(CodeCoverage)
# TODO: Also test for gcov linking path, or add SKIP_COV option.
if (LCOV_PATH) if (LCOV_PATH)
message(STATUS "Found LCOV: ${LCOV_PATH}") message(STATUS "Found LCOV: ${LCOV_PATH}")
target_link_libraries(caosdb gcov) target_link_libraries(caosdb gcov)
...@@ -111,5 +110,7 @@ if (LCOV_PATH) ...@@ -111,5 +110,7 @@ if (LCOV_PATH)
set_target_properties(ccaosdb PROPERTIES set_target_properties(ccaosdb PROPERTIES
COMPILE_FLAGS "${TARGET_CCAOSDB_COMPILE_FLAGS}") COMPILE_FLAGS "${TARGET_CCAOSDB_COMPILE_FLAGS}")
else () else ()
if (NOT SKIP_CODE_COVERAGE)
message(WARNING "Could not generate code coverage report. Please install lcov.") message(WARNING "Could not generate code coverage report. Please install lcov.")
endif() endif()
endif ()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment