Compare commits
3 Commits
c2ac523d86
...
3eb1e2c22e
Author | SHA1 | Date | |
---|---|---|---|
3eb1e2c22e | |||
ece04ba69b | |||
7e50160742 |
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(myx-cmake VERSION 0.4.5 LANGUAGES)
|
||||
project(myx-cmake VERSION 0.4.6 LANGUAGES)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake
|
||||
|
@ -6,21 +6,32 @@ if(MYX_CMAKE_CODE_COVERAGE)
|
||||
endif()
|
||||
|
||||
function(myx_cmake_code_coverage target)
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC AND MYX_CMAKE_CODE_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(
|
||||
${target}-coverage
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${LCOV_EXE} --test-name ${target} --output "${target}.lcov" --capture
|
||||
--exclude "/usr/\\\*"
|
||||
--exclude "${CMAKE_BINARY_DIR}/\\\*"
|
||||
--no-exernal
|
||||
--base-directory ${CMAKE_SOURCE_DIR}
|
||||
--directory ${CMAKE_BINARY_DIR})
|
||||
# --exclude "/usr/\\\*"
|
||||
# --exclude "${CMAKE_BINARY_DIR}/\\\*"
|
||||
add_dependencies(${target}-coverage ${target})
|
||||
|
||||
if(GENHTML_EXE)
|
||||
|
Loading…
Reference in New Issue
Block a user