Skip to content

Commit 33e2c85

Browse files
author
Vollstrecker
committed
Fix code-coverage on pure clang builds
1 parent abc1ba2 commit 33e2c85

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,15 @@ if(ZLIB_BUILD_STATIC)
8989
endforeach(ver RANGE 11 99)
9090

9191
find_program(GCOV_EXECUTABLE NAMES ${llvm_names})
92+
9293
set(llvm_option "gcov")
94+
set(compile_opts -rtlib=compiler_rt)
9395
endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
9496

9597
add_executable(infcover infcover.c)
9698
target_link_libraries(infcover ZLIB::ZLIBSTATIC)
97-
target_compile_options(infcover PRIVATE -coverage)
98-
target_link_options(infcover PRIVATE -coverage)
99+
target_compile_options(infcover PRIVATE --coverage ${compile_opts})
100+
target_link_options(infcover PRIVATE --coverage)
99101
target_compile_definitions(
100102
infcover PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
101103
add_test(NAME zlib-coverage COMMAND infcover)

0 commit comments

Comments
 (0)