diff options
author | Robert Tari <robert@tari.in> | 2021-05-11 12:35:31 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2021-05-11 12:35:31 +0200 |
commit | b03e69d72caad52fb82785de1634435545d84507 (patch) | |
tree | 68948747b6a00ad66d55da15db2c74ef2cebea83 | |
parent | f853eda7fa6f1c9337dc06f5cff738dc4da4c643 (diff) | |
parent | 0261d5a608318f6326c148cebafc0dcff2b5bb31 (diff) | |
download | ayatana-indicator-power-b03e69d72caad52fb82785de1634435545d84507.tar.gz ayatana-indicator-power-b03e69d72caad52fb82785de1634435545d84507.tar.bz2 ayatana-indicator-power-b03e69d72caad52fb82785de1634435545d84507.zip |
Merge branch 'sunweaver-pr/fix-cmake-coverage-reporting'
Attributes GH PR #28: https://github.com/AyatanaIndicators/ayatana-indicator-power/pull/28
-rw-r--r-- | CMakeLists.txt | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ca8dbe..4be6ca1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,16 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(PROJECT_VERSION "2.1.2") set(PACKAGE ${CMAKE_PROJECT_NAME}) -option (enable_tests "Build the package's automatic tests." ON) +# Options +option(ENABLE_TESTS "Enable all tests and checks" OFF) +option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF) + +if(ENABLE_COVERAGE) + set(ENABLE_TESTS ON) + set(CMAKE_BUILD_TYPE "Coverage") +else() + set(CMAKE_BUILD_TYPE "Release") +endif() ## ## GNU standard installation directories @@ -85,13 +94,15 @@ add_subdirectory(po) # testing & coverage -if (${enable_tests}) +if (ENABLE_TESTS) 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}/* - ) + if (ENABLE_COVERAGE) + find_package(CoverageReport) + ENABLE_COVERAGE_REPORT( + TARGETS ayatanaindicatorpowerservice ayatana-indicator-power-service + TESTS ${COVERAGE_TEST_TARGETS} + FILTER /usr/include ${CMAKE_BINARY_DIR}/* + ) + endif () endif () |