From 0894e96ec2c9c238e4de46cd85e5614005f56d54 Mon Sep 17 00:00:00 2001 From: Owen Date: Tue, 20 Aug 2019 17:18:32 +0100 Subject: [PATCH] Tidy up cmake commands for coverage These commands are equivalent --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f9faec981b1..040355d10d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,10 +70,10 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" ) - set(enable_coverage off CACHE BOOL "Build with coverage recording") + option(enable_coverage "Build with coverage recording") set(parallel_tests "1" CACHE STRING "Number of tests to run in parallel") - if(${enable_coverage}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -g") + if(enable_coverage) + add_compile_options(--coverage -g) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage -g") if (NOT DEFINED CODE_COVERAGE_OUTPUT_DIR) set(CODE_COVERAGE_OUTPUT_DIR ${CMAKE_BINARY_DIR}/html)