@@ -159,21 +159,7 @@ if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED)
159
159
endif ()
160
160
161
161
# Targets
162
- if (${CMAKE_VERSION} VERSION_LESS "3.17.0" )
163
- add_custom_target (
164
- ccov-clean
165
- COMMAND
166
- ${CMAKE_COMMAND} -E remove -f #
167
- ${CMAKE_COVERAGE_DATA_DIRECTORY} /objects/*
168
- ${CMAKE_COVERAGE_DATA_DIRECTORY} /profraw/*)
169
- else ()
170
- add_custom_target (
171
- ccov-clean
172
- COMMAND
173
- ${CMAKE_COMMAND} -E rm -f #
174
- ${CMAKE_COVERAGE_DATA_DIRECTORY} /objects/*
175
- ${CMAKE_COVERAGE_DATA_DIRECTORY} /profraw/*)
176
- endif ()
162
+ add_custom_target (ccov-clean)
177
163
178
164
# Used to get the shared object file list before doing the main all-
179
165
# processing
@@ -377,6 +363,20 @@ function(target_code_coverage TARGET_NAME)
377
363
endif ()
378
364
endforeach ()
379
365
366
+ if (${CMAKE_VERSION} VERSION_LESS "3.17.0" )
367
+ add_custom_target (
368
+ ccov-clean-${target_code_coverage_COVERAGE_TARGET_NAME}
369
+ COMMAND ${CMAKE_COMMAND} -E remove -f
370
+ ${target_code_coverage_COVERAGE_TARGET_NAME} .profraw)
371
+ else ()
372
+ add_custom_target (
373
+ ccov-clean-${target_code_coverage_COVERAGE_TARGET_NAME}
374
+ COMMAND ${CMAKE_COMMAND} -E rm -f
375
+ ${target_code_coverage_COVERAGE_TARGET_NAME} .profraw)
376
+ endif ()
377
+ add_dependencies (ccov-clean
378
+ ccov-clean-${target_code_coverage_COVERAGE_TARGET_NAME} )
379
+
380
380
# Run the executable, generating raw profile data Make the run data
381
381
# available for further processing. Separated to allow Windows to run this
382
382
# target serially.
@@ -500,6 +500,8 @@ function(target_code_coverage TARGET_NAME)
500
500
COMMAND ${CMAKE_COMMAND} -E rm -f ${COVERAGE_INFO}
501
501
COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters)
502
502
endif ()
503
+ add_dependencies (ccov-clean
504
+ ccov-clean-${target_code_coverage_COVERAGE_TARGET_NAME} )
503
505
504
506
# Run the executable, generating coverage information
505
507
add_custom_command (
@@ -765,15 +767,14 @@ function(add_code_coverage_all_targets)
765
767
add_custom_target (
766
768
ccov-all -clean
767
769
COMMAND ${CMAKE_COMMAND} -E remove -f ${COVERAGE_INFO}
768
- COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters
769
- DEPENDS ccov-all -processing)
770
+ COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters)
770
771
else ()
771
772
add_custom_target (
772
773
ccov-all -clean
773
774
COMMAND ${CMAKE_COMMAND} -E rm -f ${COVERAGE_INFO}
774
- COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters
775
- DEPENDS ccov-all -processing)
775
+ COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters)
776
776
endif ()
777
+ add_dependencies (ccov-clean ccov-all -clean)
777
778
778
779
add_custom_command (
779
780
OUTPUT ${COVERAGE_INFO}
0 commit comments