diff --git a/CMakeLists.txt b/CMakeLists.txt index 5825292..f3c6844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,4 +315,17 @@ target_compile_options(alltests PUBLIC ${GMOCK_CFLAGS} ${GTEST_CFLAGS}) enable_testing() gtest_discover_tests(alltests TEST_PREFIX alltests:) +add_custom_target(coverage + ./alltests + COMMAND mkdir -p coverage + COMMAND lcov --capture --directory . --output-file coverage/lcov.info + COMMAND lcov --remove coverage/lcov.info '/usr/*' --output-file coverage/lcov.info +) +add_dependencies(coverage alltests) + +add_custom_target(coverage-report + COMMAND genhtml coverage/lcov.info --output-directory coverage/report +) +add_dependencies(coverage-report coverage) + endif(NOT WITHOUT_TESTS) diff --git a/create_coverage.sh b/create_coverage.sh deleted file mode 100755 index 2291522..0000000 --- a/create_coverage.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# Note: lcov is needed to generate coverage report -# - -mkdir -p .build/coverage -lcov --capture --directory . --output-file .build/coverage/lcov.info -genhtml .build/coverage/lcov.info --output-directory .build/coverage/report \ No newline at end of file