diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-04-16 09:40:15 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-04-16 09:40:15 +0200 |
commit | 6f682d7d94a30433531137476cd4aaa4dd200f3b (patch) | |
tree | 673f943db1f1df0e583509858f2c62c78708f9a7 /ecmake/cmake/Modules/EFLlcov.cmake | |
parent | 2224f05d43a0d782b626d09f397767597b3d7f4f (diff) | |
parent | 23929ded8ba244359e871e1d02ee1d05d060ea71 (diff) | |
download | skeletons-6f682d7d94a30433531137476cd4aaa4dd200f3b.zip skeletons-6f682d7d94a30433531137476cd4aaa4dd200f3b.tar.gz |
Merge branch 'master' of asynk.ch:templates
Diffstat (limited to 'ecmake/cmake/Modules/EFLlcov.cmake')
-rw-r--r-- | ecmake/cmake/Modules/EFLlcov.cmake | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ecmake/cmake/Modules/EFLlcov.cmake b/ecmake/cmake/Modules/EFLlcov.cmake new file mode 100644 index 0000000..e151df9 --- /dev/null +++ b/ecmake/cmake/Modules/EFLlcov.cmake @@ -0,0 +1,31 @@ +macro(ENABLE_COVERAGE) + if (CHECK_ENABLED) + find_program(LCOV_BINARY lcov HINTS ${EFL_LCOV_PATH}) + find_program(GENHTML_BINARY genhtml HINTS ${EFL_LCOV_PATH}) + set(EFL_COVERAGE_CFLAGS "-fprofile-arcs -ftest-coverage") + set(EFL_COVERAGE_LIBS "gcov") + endif (CHECK_ENABLED) + + if (DEFINED LCOV_BINARY) + set(EFL_COVERAGE_ENABLED true) + add_custom_target(lcov-reset + COMMAND rm -rf ${CMAKE_BINARY_DIR}/coverage + COMMAND find ${CMAKE_BINARY_DIR} -name "*.gcda" -delete + COMMAND ${LCOV_BINARY} --zerocounters --directory ${CMAKE_BINARY_DIR} + ) + + add_custom_target(lcov-report + COMMAND mkdir ${CMAKE_BINARY_DIR}/coverage + COMMAND ${LCOV_BINARY} --capture --compat-libtool --output-file ${CMAKE_BINARY_DIR}/coverage/coverage.info --directory ${CMAKE_BINARY_DIR} + COMMAND ${LCOV_BINARY} --remove ${CMAKE_BINARY_DIR}/coverage/coverage.info '*.h' --output-file ${CMAKE_BINARY_DIR}/coverage/coverage.cleaned.info + COMMAND ${GENHTML_BINARY} -t "${PACKAGE}" -o "${CMAKE_BINARY_DIR}/coverage/html" "${CMAKE_BINARY_DIR}/coverage/coverage.cleaned.info" + COMMAND echo "Coverage Report at ${CMAKE_BINARY_DIR}/coverage/html" + ) + + add_custom_target(coverage + COMMAND ${CMAKE_MAKE_PROGRAM} lcov-reset + COMMAND ${CMAKE_MAKE_PROGRAM} check + COMMAND ${CMAKE_MAKE_PROGRAM} lcov-report + ) + endif (DEFINED LCOV_BINARY) +endmacro(ENABLE_COVERAGE) |