aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRodney Dawes <dobey.pwns@gmail.com>2018-03-16 07:33:13 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-03-16 10:44:38 +0100
commit744720d0a29eb327aa0c25b4f3c4c134eb78e855 (patch)
tree61700490ba50b028a3144f1b4be5c34ad5e79b07 /CMakeLists.txt
parent970f3823f1c14e094630e63d8d9b79235cb9bacf (diff)
downloadayatana-indicator-power-744720d0a29eb327aa0c25b4f3c4c134eb78e855.tar.gz
ayatana-indicator-power-744720d0a29eb327aa0c25b4f3c4c134eb78e855.tar.bz2
ayatana-indicator-power-744720d0a29eb327aa0c25b4f3c4c134eb78e855.zip
Use coverage support from cmake-extras.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt27
1 files changed, 10 insertions, 17 deletions
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}/*
+)