When running my CTest dashboard script with coverage flags enabled, it works perfectly for GCC. But for Clang builds, I get output such as:
Command produced error: D:/a/BenBot/BenBot/Builds/clang/libbenbot/resources/CMakeFiles/ben_bot_resources_internal.dir/Debug/__cmrc_ben_bot_resources_internal/intermediate/res/bench.epd.cpp.gcno:version 'B11*', prefer 'B52*'
Access violation
Access violation
Problem running coverage on file: D:/a/BenBot/BenBot/Builds/clang/libbenbot/resources/CMakeFiles/ben_bot_resources_internal.dir/Debug/__cmrc_ben_bot_resources_internal/intermediate/res/license_header.txt.cpp.gcda
Command produced error: D:/a/BenBot/BenBot/Builds/clang/libbenbot/resources/CMakeFiles/ben_bot_resources_internal.dir/Debug/__cmrc_ben_bot_resources_internal/intermediate/res/license_header.txt.cpp.gcno:version 'B11*', prefer 'B52*'
Access violation
Coverage command returned: 3 while processing: D:/a/BenBot/BenBot/Builds/clang/libbenbot/resources/CMakeFiles/ben_bot_resources_internal.dir/Debug/__cmrc_ben_bot_resources_internal/lib.cpp.gcda
Command produced error: 2
Coverage command returned: 3 while processing: D:/a/BenBot/BenBot/Builds/clang/libchess/CMakeFiles/libchess.dir/Debug/src/board/Distances.cpp.gcda
Command produced error: 2
The build itself produces no warnings/errors, and all tests pass, but CTest exits with code 32.
The coverage flags config is:
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
get_cmake_property (debug_configs DEBUG_CONFIGURATIONS)
if (NOT debug_configs)
set (debug_configs Debug)
endif ()
list (JOIN debug_configs "," debug_configs)
set (config_debug "$<CONFIG:${debug_configs}>")
add_compile_options ("$<${config_debug}:-g;-O0;--coverage>")
add_link_options ("$<${config_debug}:--coverage>")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
link_libraries (gcov)
endif ()
endif ()
An example build log is [here](CI (benthevining) · benthevining/BenBot@270d93b · GitHub), and the CDash dashboard is [here](https://my.cdash.org/index.php?project=ben-bot).
Is there something wrong with the coverage flags I’m using? Should I consider using a custom CTest script instead of just ctest -D, so that I can silence the spurious exit code?