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
Branches
Tags
2 merge requests!33Release 0.1,!30Debug build
Pipeline #14807 failed
This commit is part of merge request !33. Comments created here will be created in the context of that merge request.
......@@ -136,6 +136,18 @@
include(CMakeParseArguments)
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
find_program( GCOV_PATH gcov )
......
......@@ -88,7 +88,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/caosdb_test_utility.h.in
include(CodeCoverage)
# TODO: Also test for gcov linking path, or add SKIP_COV option.
if (LCOV_PATH)
message(STATUS "Found LCOV: ${LCOV_PATH}")
target_link_libraries(caosdb gcov)
......@@ -111,5 +110,7 @@ if (LCOV_PATH)
set_target_properties(ccaosdb PROPERTIES
COMPILE_FLAGS "${TARGET_CCAOSDB_COMPILE_FLAGS}")
else ()
message(WARNING "Could not generate code coverage report. Please install lcov.")
if (NOT SKIP_CODE_COVERAGE)
message(WARNING "Could not generate code coverage report. Please install lcov.")
endif()
endif ()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment