mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
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:
@@ -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()
|
||||
|
||||
|
||||
@@ -25,7 +25,10 @@ set(pkd_libs
|
||||
|
||||
add_executable(pkd_hello ${pkd_hello_src})
|
||||
target_compile_options(pkd_hello PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||
target_link_libraries(pkd_hello ${pkd_libs})
|
||||
target_link_libraries(pkd_hello PRIVATE ${pkd_libs})
|
||||
if (WITH_COVERAGE)
|
||||
append_coverage_compiler_flags_to_target(pkd_hello)
|
||||
endif (WITH_COVERAGE)
|
||||
|
||||
#
|
||||
# pkd_hello_i1 runs only one iteration per algorithm combination for
|
||||
|
||||
@@ -12,6 +12,9 @@ add_library(testserver STATIC
|
||||
test_server.c
|
||||
default_cb.c
|
||||
sftpserver_cb.c)
|
||||
if (WITH_COVERAGE)
|
||||
append_coverage_compiler_flags_to_target(testserver)
|
||||
endif (WITH_COVERAGE)
|
||||
|
||||
set(LIBSSH_SERVER_TESTS
|
||||
# torture_server_kbdint
|
||||
@@ -29,10 +32,10 @@ if (UNIX AND NOT WIN32)
|
||||
add_executable(test_server ${server_SRCS})
|
||||
target_compile_options(test_server PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||
target_link_libraries(test_server
|
||||
testserver
|
||||
ssh::ssh
|
||||
${ARGP_LIBRARIES}
|
||||
util)
|
||||
PRIVATE testserver ssh::ssh ${ARGP_LIBRARIES} util)
|
||||
if (WITH_COVERAGE)
|
||||
append_coverage_compiler_flags_to_target(test_server)
|
||||
endif (WITH_COVERAGE)
|
||||
endif ()
|
||||
|
||||
endif (WITH_SERVER AND UNIX AND NOT WIN32)
|
||||
|
||||
Reference in New Issue
Block a user