From 744720d0a29eb327aa0c25b4f3c4c134eb78e855 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Fri, 16 Mar 2018 07:33:13 +0100 Subject: Use coverage support from cmake-extras. --- CMakeLists.txt | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e17f11..fa06e7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,9 +6,6 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(PROJECT_VERSION "2.0.92") set(PACKAGE ${CMAKE_PROJECT_NAME}) -option (enable_tests "Build the package's automatic tests." ON) -option (enable_lcov "Generate lcov code coverage reports." ON) - ## ## GNU standard installation directories ## @@ -61,9 +58,6 @@ add_custom_target (dist COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.gz WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -add_custom_target (clean-coverage - COMMAND find ${CMAKE_BINARY_DIR} -name '*.gcda' | xargs rm -f) - add_custom_target (cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2 --inline-suppr ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests) @@ -85,19 +79,18 @@ set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-missing-field-initializers") # GActio include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories (${CMAKE_CURRENT_BINARY_DIR}/include) -# testing & coverage -if (${enable_tests}) - enable_testing () - if (${enable_lcov}) - include(GCov) - endif () -endif () - # actually build things add_subdirectory(src) add_subdirectory(data) add_subdirectory(po) -if (${enable_tests}) - add_subdirectory(tests) -endif () + +# testing & coverage +enable_testing () +add_subdirectory(tests) +find_package(CoverageReport) +ENABLE_COVERAGE_REPORT( + TARGETS ${SERVICE_LIB} ${SERVICE_EXEC} + TESTS ${COVERAGE_TEST_TARGETS} + FILTER /usr/include ${CMAKE_BINARY_DIR}/* +) -- cgit v1.2.3