Compare commits

..

No commits in common. "3eb1e2c22e04dc79873844eddd64a13c6e9bc16b" and "c2ac523d86b3fbe0c524a1eb77f2d6260ba1c360" have entirely different histories.

2 changed files with 9 additions and 20 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(myx-cmake VERSION 0.4.6 LANGUAGES) project(myx-cmake VERSION 0.4.5 LANGUAGES)
include(GNUInstallDirs) include(GNUInstallDirs)
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake

View File

@ -6,32 +6,21 @@ if(MYX_CMAKE_CODE_COVERAGE)
endif() endif()
function(myx_cmake_code_coverage target) function(myx_cmake_code_coverage target)
if(MYX_CMAKE_CODE_COVERAGE) if(CMAKE_CXX_COMPILER_IS_GCC AND MYX_CMAKE_CODE_COVERAGE)
if(CMAKE_CXX_COMPILER_IS_GCC) target_compile_options(${target} PUBLIC "--coverage")
target_compile_options(${target} PUBLIC "--coverage") set_property(
set_property( TARGET ${target}
TARGET ${target} APPEND_STRING
APPEND_STRING PROPERTY LINK_FLAGS " --coverage")
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(
${target}-coverage ${target}-coverage
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${LCOV_EXE} --test-name ${target} --output "${target}.lcov" --capture COMMAND ${LCOV_EXE} --test-name ${target} --output "${target}.lcov" --capture
--no-exernal --exclude "/usr/\\\*"
--base-directory ${CMAKE_SOURCE_DIR} --exclude "${CMAKE_BINARY_DIR}/\\\*"
--directory ${CMAKE_BINARY_DIR}) --directory ${CMAKE_BINARY_DIR})
# --exclude "/usr/\\\*"
# --exclude "${CMAKE_BINARY_DIR}/\\\*"
add_dependencies(${target}-coverage ${target}) add_dependencies(${target}-coverage ${target})
if(GENHTML_EXE) if(GENHTML_EXE)