Skip to content

Commit 2953f43

Browse files
author
owen-jones-diffblue
authored
Merge pull request #5046 from owen-jones-diffblue/owen/tidy-up-coverage-cmake-file
Tidy up cmake commands for coverage
2 parents 5a6e58b + 0894e96 commit 2953f43

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
7070
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR
7171
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"
7272
)
73-
set(enable_coverage off CACHE BOOL "Build with coverage recording")
73+
option(enable_coverage "Build with coverage recording")
7474
set(parallel_tests "1" CACHE STRING "Number of tests to run in parallel")
75-
if(${enable_coverage})
76-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -g")
75+
if(enable_coverage)
76+
add_compile_options(--coverage -g)
7777
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage -g")
7878
if (NOT DEFINED CODE_COVERAGE_OUTPUT_DIR)
7979
set(CODE_COVERAGE_OUTPUT_DIR ${CMAKE_BINARY_DIR}/html)

0 commit comments

Comments
 (0)