mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
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
13 lines
368 B
CMake
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)
|