Skip to content

Commit eda68ce

Browse files
committed
Remove ccov-libs target from LLVM-based coverage
The ccov-libs target no longer matters, as the preferred solution is to provide objects to the executed targets instead, and the 'all' targets would obtain shared libraries from the objects.list instead.
1 parent 2b4d9cb commit eda68ce

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

code-coverage.cmake

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,6 @@ if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED)
161161
# Targets
162162
add_custom_target(ccov-clean)
163163

164-
# Used to get the shared object file list before doing the main all-
165-
# processing
166-
add_custom_target(
167-
ccov-libs
168-
COMMAND ;
169-
COMMENT "libs ready for coverage report.")
170-
171164
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES
172165
"GNU")
173166
# Messages
@@ -315,35 +308,6 @@ function(target_code_coverage TARGET_NAME)
315308
# Targets
316309
get_target_property(target_type ${TARGET_NAME} TYPE)
317310

318-
# Add shared library to processing for 'all' targets
319-
if(target_type STREQUAL "SHARED_LIBRARY" AND target_code_coverage_ALL)
320-
if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang"
321-
OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
322-
add_custom_command(
323-
OUTPUT
324-
${CMAKE_COVERAGE_DATA_DIRECTORY}/objects/${target_code_coverage_COVERAGE_TARGET_NAME}
325-
COMMAND
326-
${CMAKE_COMMAND} -E echo "-object=$<TARGET_FILE:${TARGET_NAME}>" >
327-
${CMAKE_COVERAGE_DATA_DIRECTORY}/objects/${target_code_coverage_COVERAGE_TARGET_NAME}
328-
DEPENDS ${TARGET_NAME})
329-
add_custom_target(
330-
ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}
331-
DEPENDS
332-
${CMAKE_COVERAGE_DATA_DIRECTORY}/objects/${target_code_coverage_COVERAGE_TARGET_NAME}
333-
)
334-
335-
if(NOT TARGET ccov-libs)
336-
message(
337-
FATAL_ERROR
338-
"Calling target_code_coverage with 'ALL' must be after a call to 'add_code_coverage_all_targets'."
339-
)
340-
endif()
341-
342-
add_dependencies(ccov-libs
343-
ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME})
344-
endif()
345-
endif()
346-
347311
# For executables add targets to run and produce output
348312
if(target_type STREQUAL "EXECUTABLE")
349313
if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang"
@@ -398,7 +362,7 @@ function(target_code_coverage TARGET_NAME)
398362
${CMAKE_COVERAGE_DATA_DIRECTORY}/profraw/${target_code_coverage_COVERAGE_TARGET_NAME}
399363
COMMAND ${CMAKE_COMMAND} -E rm -f
400364
${CMAKE_COVERAGE_DATA_DIRECTORY}/ccov-all.profdata
401-
DEPENDS ccov-libs ${TARGET_NAME})
365+
DEPENDS ${TARGET_NAME})
402366
add_custom_target(
403367
ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}
404368
DEPENDS ${target_code_coverage_COVERAGE_TARGET_NAME}.profraw)

0 commit comments

Comments
 (0)