From eb9c7fa16556c7d13fff90fa2dc79a3f90da9fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20K=C3=B6hler?= Date: Fri, 23 Oct 2026 13:59:56 +0200 Subject: [PATCH] Fix target checks before generation --- cmake/FindLcov.cmake | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmake/FindLcov.cmake b/cmake/FindLcov.cmake index 1d48b55..166ae74 100644 --- a/cmake/FindLcov.cmake +++ b/cmake/FindLcov.cmake @@ -205,9 +205,10 @@ function (lcov_capture_initial) # Add a new target to merge the files of all targets. set(OUTFILE "${LCOV_DATA_PATH_INIT}/all_targets.info") lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_INIT_FILES}) - add_custom_target(lcov-geninfo-init ALL DEPENDS ${OUTFILE} - lcov-capture-init - ) + if (NOT TARGET lcov-geninfo-init) + add_custom_target(lcov-geninfo-init ALL DEPENDS ${OUTFILE} + lcov-capture-init) + endif() endfunction (lcov_capture_initial) @@ -318,8 +319,9 @@ function (lcov_capture) # Add a new target to merge the files of all targets. set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/all_targets.info") lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_FILES}) - add_custom_target(lcov-geninfo DEPENDS ${OUTFILE} lcov-capture) - + if (NOT TARGET lcov-geninfo) + add_custom_target(lcov-geninfo DEPENDS ${OUTFILE} lcov-capture) + endif() # Add a new global target for all lcov targets. This target could be used to # generate the lcov html output for the whole project instead of calling # -geninfo and -genhtml for each target. It will also be