From 11e8d1f8a206f0c5379ba78bc3aa044adf5a63d7 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 12 Feb 2026 11:11:26 +0000 Subject: [PATCH] chore: Fix `gcov` lib coverage build failure on macOS (#6350) For coverage builds, we try to link against the `gcov` library (specific to the environment). But as macOS doesn't have this library and thus doesn't have the coverage tools to generate reports, the coverage builds on that platform were failing on linking. We actually don't need to explicitly force this linking, as the `CodeCoverage` file already has correct detection logic (currently on lines 177-193), which is invoked when the `--coverage` flag is provided: * AppleClang: Uses `xcrun -f llvm-cov` to set `GCOV_TOOL="llvm-cov gcov"`. * Clang: Finds `llvm-cov` to set `GCOV_TOOL="llvm-cov gcov"`. * GCC: Finds `gcov` to set `GCOV_TOOL="gcov"`. The `GCOV_TOOL` is then passed to `gcovr` on line 416, so the correct tool is used for processing coverage data. This change therefore removes the `gcov` suffix from lines 473 and 475 in the `CodeCoverage.cmake` file. --- cmake/CodeCoverage.cmake | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake index 0178d68cc0..fcc4d44133 100644 --- a/cmake/CodeCoverage.cmake +++ b/cmake/CodeCoverage.cmake @@ -466,11 +466,6 @@ function (add_code_coverage_to_target name scope) target_compile_options(${name} ${scope} $<$:${COVERAGE_CXX_COMPILER_FLAGS}> $<$:${COVERAGE_C_COMPILER_FLAGS}>) - target_link_libraries( - ${name} - ${scope} - $<$:${COVERAGE_CXX_LINKER_FLAGS} - gcov> - $<$:${COVERAGE_C_LINKER_FLAGS} - gcov>) + target_link_libraries(${name} ${scope} $<$:${COVERAGE_CXX_LINKER_FLAGS}> + $<$:${COVERAGE_C_LINKER_FLAGS}>) endfunction () # add_code_coverage_to_target