Skip to content

Commit b390fa4

Browse files
authored
Merge pull request #29 from swift-nav/rodrigor/multiple_gcov_version_support
Support for Multi-Compilers within System
2 parents 5551438 + 69c78c2 commit b390fa4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

CodeCoverage.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ if (NOT LLVM_COV_PATH)
8686
endif()
8787
find_program(LLVM_COV_PATH ${LLVM_COV_NAME})
8888
endif()
89+
find_program(GCOV_PATH gcov)
8990
find_program(LCOV_PATH lcov)
9091
find_program(GENHTML_PATH genhtml)
9192

@@ -301,11 +302,12 @@ function(target_code_coverage TARGET_NAME)
301302
add_custom_target(
302303
ccov-${TARGET_NAME}
303304
COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters
304-
COMMAND $<TARGET_FILE:${TARGET_NAME}>
305+
COMMAND $<TARGET_FILE:${TARGET_NAME}> || true
305306
COMMAND ${LCOV_PATH}
306307
--directory ${CMAKE_BINARY_DIR}
307308
--capture
308309
--output-file ${COVERAGE_INFO}
310+
$<$<BOOL:${GCOV_PATH}>:--gcov-tool=${GCOV_PATH}>
309311
COMMAND ${EXCLUDE_COMMAND}
310312
COMMAND ${GENHTML_PATH} -o
311313
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${TARGET_NAME}
@@ -466,6 +468,7 @@ function(add_code_coverage_all_targets)
466468
--directory ${CMAKE_BINARY_DIR}
467469
--capture
468470
--output-file ${COVERAGE_INFO}
471+
$<$<BOOL:${GCOV_PATH}>:--gcov-tool=${GCOV_PATH}>
469472
COMMAND ${EXCLUDE_COMMAND}
470473
COMMAND ${GENHTML_PATH} -o
471474
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged

0 commit comments

Comments
 (0)