From: Hans Kristian Rosbach Date: Sat, 8 Feb 2020 15:23:13 +0000 (+0100) Subject: Don't enable debug when building with code coverage. X-Git-Tag: 1.9.9-b1~354 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbf3128cd672c27cbfd0e82b8ee55a12bcb729a6;p=thirdparty%2Fzlib-ng.git 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. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index dda5178a..0fa88544 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()