Skip to content

Commit 31718ac

Browse files
committed
Avoid collisions of coverage targets
1 parent fbea8f1 commit 31718ac

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

CMakeLists.txt

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,25 @@ endif()
2323

2424
set(ENABLE_COVERAGE OFF CACHE BOOL "Enable coverage measurements")
2525
if(ENABLE_COVERAGE)
26-
include(CodeCoverage)
27-
message(WARNING "Enabling code coverage measurements -> disables optimizations and embeds debug information!")
26+
if(TARGET coverage)
27+
message(WARNING "Found another target coverage, not setting up coverage for linuxdeploy-desktopfile")
28+
else()
29+
include(CodeCoverage)
30+
message(WARNING "Enabling code coverage measurements -> disables optimizations and embeds debug information!")
2831

29-
append_coverage_compiler_flags()
32+
append_coverage_compiler_flags()
3033

31-
set(COVERAGE_GCOVR_EXCLUDES ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR})
34+
set(COVERAGE_GCOVR_EXCLUDES ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR})
3235

33-
include(ProcessorCount)
34-
ProcessorCount(processor_count)
36+
include(ProcessorCount)
37+
ProcessorCount(processor_count)
3538

36-
set(command cmake --build . --target all -- -j ${processor_count} && ctest -V)
39+
set(command cmake --build . --target all -- -j ${processor_count} && ctest -V)
3740

38-
setup_target_for_coverage_gcovr_html(NAME coverage EXECUTABLE "${command}")
39-
setup_target_for_coverage_gcovr_xml(NAME coverage_xml EXECUTABLE "${command}")
40-
setup_target_for_coverage_gcovr_text(NAME coverage_text EXECUTABLE "${command}")
41+
setup_target_for_coverage_gcovr_html(NAME coverage EXECUTABLE "${command}")
42+
setup_target_for_coverage_gcovr_xml(NAME coverage_xml EXECUTABLE "${command}")
43+
setup_target_for_coverage_gcovr_text(NAME coverage_text EXECUTABLE "${command}")
44+
endif()
4145
endif()
4246

4347
add_subdirectory(lib)

0 commit comments

Comments
 (0)