Rework the coverage build

This reworks it to avoid a need to special build type and adding the flags only
to the targets that need it (skipping testing wrappers which break with them).

It also updates the CodeCoverage module from the following URL:

https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2024-03-08 10:04:07 +01:00
parent 6a03f6cefe
commit 64ef3fefb4
9 changed files with 89 additions and 47 deletions

View File

@@ -26,10 +26,13 @@ add_library(${TORTURE_LIBRARY}
torture_key.c
torture_pki.c
torture_cmocka.c)
target_link_libraries(${TORTURE_LIBRARY} ${TORTURE_LINK_LIBRARIES})
target_link_libraries(${TORTURE_LIBRARY} PRIVATE ${TORTURE_LINK_LIBRARIES})
target_compile_options(${TORTURE_LIBRARY} PRIVATE
-DSSH_PING_EXECUTABLE="${CMAKE_CURRENT_BINARY_DIR}/ssh_ping"
)
if (WITH_COVERAGE)
append_coverage_compiler_flags_to_target(${TORTURE_LIBRARY})
endif (WITH_COVERAGE)
# The shared version of the library is only useful when client testing is
# enabled
@@ -60,7 +63,7 @@ if (CLIENT_TESTING)
torture_pki.c
torture_cmocka.c
)
target_link_libraries(${TORTURE_SHARED_LIBRARY}
target_link_libraries(${TORTURE_SHARED_LIBRARY} PUBLIC
${CMOCKA_LIBRARY}
ssh::static
${WRAP_SYMBOLS}
@@ -69,11 +72,14 @@ if (CLIENT_TESTING)
-DSSH_PING_EXECUTABLE="${CMAKE_CURRENT_BINARY_DIR}/ssh_ping"
-DTORTURE_SHARED
)
if (WITH_COVERAGE)
append_coverage_compiler_flags_to_target(${TORTURE_SHARED_LIBRARY})
endif (WITH_COVERAGE)
endif ()
if (ARGP_LIBRARIES)
target_link_libraries(${TORTURE_LIBRARY}
${ARGP_LIBRARIES}
PUBLIC ${ARGP_LIBRARIES}
)
endif()