aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-06-11 13:02:33 +0200
committerRobert Tari <robert@tari.in>2021-06-11 13:19:03 +0200
commit887b5f92bdd6485a4da521086ec88e63357d2260 (patch)
tree06c2e07e757b6d5ef556b10922d7c236f3fdb7b3 /CMakeLists.txt
parenta2aac2de9402709a0eeea16fb893d261a61624e6 (diff)
downloadayatana-indicator-session-887b5f92bdd6485a4da521086ec88e63357d2260.tar.gz
ayatana-indicator-session-887b5f92bdd6485a4da521086ec88e63357d2260.tar.bz2
ayatana-indicator-session-887b5f92bdd6485a4da521086ec88e63357d2260.zip
Convert testing and coverage reporting to cmake-extras style
fixes https://github.com/AyatanaIndicators/ayatana-indicator-session/issues/34
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 15 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 51e6c0a..f067b8a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,9 +57,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)
@@ -67,28 +64,24 @@ add_custom_target (cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories (${CMAKE_CURRENT_BINARY_DIR}/src)
-# testing & coverage
-if (${ENABLE_TESTS})
-
- if (EXISTS /usr/src/googletest/src)
- set (GTEST_SOURCE_DIR /usr/src/googletest/src)
- else ()
- set (GTEST_SOURCE_DIR /usr/src/gtest/src)
- endif ()
- set (GTEST_INCLUDE_DIR ${GTEST_SOURCE_DIR}/..)
- set (GTEST_LIBS -lpthread)
- enable_testing ()
- if (${ENABLE_COVERAGE})
- include(GCov)
- endif ()
-endif ()
-
add_subdirectory (src)
add_subdirectory (data)
add_subdirectory (po)
-if (${ENABLE_TESTS})
- add_subdirectory (tests)
-endif ()
+
+if (ENABLE_TESTS)
+
+ include(CTest)
+ enable_testing()
+ add_subdirectory(tests)
+
+ if (ENABLE_COVERAGE)
+
+ find_package(CoverageReport)
+ ENABLE_COVERAGE_REPORT(TARGETS "libayatanaindicatorsessionservice" "ayatana-indicator-session-service" TESTS "test-service" "test-actions" "test-guest" "test-users" FILTER /usr/include ${CMAKE_BINARY_DIR}/*)
+
+ endif()
+
+endif()
# Display config info