Skip to content

Commit 6bcb1bc

Browse files
authored
build: remove GCDA files before linking test targets (#97)
1 parent 0185b10 commit 6bcb1bc

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ if(NOT_SUBPROJECT)
5151
if(NOT MSVC)
5252
target_compile_options(errors_test PRIVATE --coverage -O0 -fno-exceptions)
5353
target_link_options(errors_test PRIVATE --coverage)
54+
55+
get_target_property(errors_test_SOURCES errors_test SOURCES)
56+
foreach(SOURCE ${errors_test_SOURCES})
57+
set(GCDA ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/errors_test.dir/${SOURCE}.gcda)
58+
add_custom_command(
59+
TARGET errors_test PRE_LINK
60+
COMMAND ${CMAKE_COMMAND} -E rm -f ${GCDA}
61+
)
62+
endforeach()
5463
endif()
5564

5665
catch_discover_tests(errors_test)

components/format/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ if(NOT_SUBPROJECT)
2020
if(NOT MSVC)
2121
target_compile_options(errors_format_test PRIVATE --coverage -O0 -fno-exceptions)
2222
target_link_options(errors_format_test PRIVATE --coverage)
23+
24+
get_target_property(errors_format_test_SOURCES errors_format_test SOURCES)
25+
foreach(SOURCE ${errors_format_test_SOURCES})
26+
set(GCDA ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/errors_format_test.dir/${SOURCE}.gcda)
27+
add_custom_command(
28+
TARGET errors_format_test PRE_LINK
29+
COMMAND ${CMAKE_COMMAND} -E rm -f ${GCDA}
30+
)
31+
endforeach()
2332
endif()
2433

2534
catch_discover_tests(errors_format_test)

0 commit comments

Comments
 (0)