Поддержка проверки покрытия кода в Clang

This commit is contained in:
Andrei Astafev 2022-01-11 09:56:00 +03:00
parent c2ac523d86
commit 7e50160742

View File

@ -6,12 +6,21 @@ if(MYX_CMAKE_CODE_COVERAGE)
endif()
function(myx_cmake_code_coverage target)
if(CMAKE_CXX_COMPILER_IS_GCC AND MYX_CMAKE_CODE_COVERAGE)
target_compile_options(${target} PUBLIC "--coverage")
set_property(
TARGET ${target}
APPEND_STRING
PROPERTY LINK_FLAGS " --coverage")
if(MYX_CMAKE_CODE_COVERAGE)
if(CMAKE_CXX_COMPILER_IS_GCC)
target_compile_options(${target} PUBLIC "--coverage")
set_property(
TARGET ${target}
APPEND_STRING
PROPERTY LINK_FLAGS " --coverage")
endif()
if(CMAKE_CXX_COMPILER_IS_CLANG)
target_compile_options(${target} PUBLIC "-fprofile-instr-generate -fcoverage-mapping")
set_property(
TARGET ${target}
APPEND_STRING
PROPERTY LINK_FLAGS " --coverage")
endif()
if(LCOV_EXE)
add_custom_target(