Files
Joseph Snyder a79ac015c6 ctest: Merge llvm-cov's .profraw files into a .profdata file for each test
If the CTEST_TEST_COVERAGE_TOOL is set to LLVM-COV, use the
`llvm-profdata --merge` functionality to collect the `.profraw` files
generated by running each test into a combined `.profdata` file.
This is the file that could be used to parse or display coverage
information for each test.

Issue: #26932
2026-05-11 11:33:41 -04:00

13 lines
368 B
CMake

enable_language(C)
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
message(FATAL_ERROR "This test requires a Clang C compiler.")
endif()
string(APPEND CMAKE_C_FLAGS " -fprofile-instr-generate -fcoverage-mapping")
set(CTEST_TEST_COVERAGE_TOOL "LLVM-COV")
include(CTest)
add_executable(ClangCoverage ClangCoverage.c)
add_test(NAME ClangCoverage COMMAND ClangCoverage)