aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/CMakeLists.txt35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c820ed5..3fffe9e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -59,6 +59,41 @@ if(ZLIB_BUILD_STATIC)
59 add_executable(static_minigzip minigzip.c) 59 add_executable(static_minigzip minigzip.c)
60 target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC) 60 target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC)
61 61
62 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
63 ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
64 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
65 find_program(GCOV_EXECUTABLE gcov)
66 endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
67
68 if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
69 set(llvm_names llvm_cov)
70
71 foreach(ver RANGE 11 99)
72 list(APPEND llvm_names llvm-cov-${ver})
73 endforeach(ver RANGE 11 99)
74
75 find_program(GCOV_EXECUTABLE NAMES ${llvm_names})
76 set(llvm_option "gcov")
77 endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
78
79 add_executable(infcover infcover.c)
80 target_link_libraries(infcover ZLIB::ZLIBSTATIC)
81 target_compile_options(infcover PRIVATE -coverage)
82 target_link_options(infcover PRIVATE -coverage)
83 target_compile_definitions(infcover
84 PRIVATE
85 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
86 add_test (NAME coverage COMMAND infcover)
87 set (INFCOVER_DIR
88 ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/infcover.dir)
89 add_test (NAME coverage-summary
90 COMMAND ${GCOV_EXECUTABLE} ${llvm_option}
91 ${CMAKE_CURRENT_SOURCE_DIR}/infcover.c
92 -o ${INFCOVER_DIR}/infcover.c.gcda)
93 set_tests_properties(coverage-summary PROPERTIES DEPENDS incover)
94 endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
95 ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
96
62 if(HAVE_OFF64_T) 97 if(HAVE_OFF64_T)
63 add_executable(zlib_static_example64 example.c) 98 add_executable(zlib_static_example64 example.c)
64 target_compile_definitions(zlib_static_example64 99 target_compile_definitions(zlib_static_example64