summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Kristian Rosbach <hk-git@circlestorm.org>2020-02-08 16:23:13 +0100
committerHans Kristian Rosbach <hk-github@circlestorm.org>2020-03-09 14:13:36 +0100
commitfbf3128cd672c27cbfd0e82b8ee55a12bcb729a6 (patch)
tree0de78f66aab8cbd23a70c59f82e651c3728b8438
parent1e14f24edee70c6a6718d81e65eb19738622edde (diff)
downloadProject-Tick-fbf3128cd672c27cbfd0e82b8ee55a12bcb729a6.tar.gz
Project-Tick-fbf3128cd672c27cbfd0e82b8ee55a12bcb729a6.zip
Don't enable debug when building with code coverage.
Don't disable optimization when building with code coverage. Make sure GCC links with gcov, like the docs says you should.
-rw-r--r--CMakeLists.txt6
1 files changed, 4 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dda5178a60..0fa88544bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -258,10 +258,12 @@ else()
endif()
if(WITH_CODE_COVERAGE)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -coverage")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -coverage")
elseif(__GNUC__)
# Some versions of GCC don't support -coverage shorthand
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fprofile-arcs -ftest-coverage")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov")
endif()
endif()