Поддержка проверки покрытия кода в 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() endif()
function(myx_cmake_code_coverage target) function(myx_cmake_code_coverage target)
if(CMAKE_CXX_COMPILER_IS_GCC AND MYX_CMAKE_CODE_COVERAGE) if(MYX_CMAKE_CODE_COVERAGE)
target_compile_options(${target} PUBLIC "--coverage") if(CMAKE_CXX_COMPILER_IS_GCC)
set_property( target_compile_options(${target} PUBLIC "--coverage")
TARGET ${target} set_property(
APPEND_STRING TARGET ${target}
PROPERTY LINK_FLAGS " --coverage") 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) if(LCOV_EXE)
add_custom_target( add_custom_target(