]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Don't enable debug when building with code coverage.
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Sat, 8 Feb 2020 15:23:13 +0000 (16:23 +0100)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 9 Mar 2020 13:13:36 +0000 (14:13 +0100)
Don't disable optimization when building with code coverage.
Make sure GCC links with gcov, like the docs says you should.

CMakeLists.txt

index dda5178a60ac3dbe79301d805760649eb1bed6f1..0fa88544bc12ef6e909a10fbb8d67e11b56abdda 100644 (file)
@@ -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()