Skip to content
Snippets Groups Projects
Commit 8b041d8a authored by Marc-Olivier Andrez's avatar Marc-Olivier Andrez
Browse files

build: add coverage flags only when `ENABLE_COVERAGE` is `ON`

parent 6cc7eb6f
No related branches found
No related tags found
No related merge requests found
......@@ -25,10 +25,12 @@ if (BUILD_TESTS)
find_program(MEMORYCHECK_COMMAND valgrind)
set(MEMORYCHECK_COMMAND_OPTIONS
"--trace-children=yes --leak-check=full --error-exitcode=1 --num-callers=20 --suppressions=${CMAKE_SOURCE_DIR}/tests/valgrind.suppressions")
if (CMAKE_COMPILER_IS_GNUCXX)
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
endif ()
if (ENABLE_COVERAGE)
if (CMAKE_COMPILER_IS_GNUCXX)
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
endif ()
endif()
endif ()
#TODO: Call add_plain_unit_test in gtest
......@@ -91,7 +93,7 @@ function(gtest target test_source_files linktarget)
if (ARGN)
LIST(GET ARGN 0 NOCOV)
endif()
if (CMAKE_COMPILER_IS_GNUCXX AND NOT 1${NOCOV} STREQUAL "1nocov")
if (ENABLE_COVERAGE AND CMAKE_COMPILER_IS_GNUCXX AND NOT 1${NOCOV} STREQUAL "1nocov")
set(COVERAGE_EXCLUDES "*/unittests/*" "*/3d_party/*" "*/python/*" "*/service_request*")
if (ARGN)
set(COVERAGE_EXCLUDES ${COVERAGE_EXCLUDES} ${ARGN})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment