aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-04-21 20:52:10 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-04-21 20:57:03 +0200
commit0573203124f66f826a0f6b06262f7610b00f0fb6 (patch)
tree3469e4ca1d3973d8c6faa57aa85567ac5811d97c
parentab041b778f0a559e75f6d9a8b10ba899e7576616 (diff)
downloadayatana-ido-0573203124f66f826a0f6b06262f7610b00f0fb6.tar.gz
ayatana-ido-0573203124f66f826a0f6b06262f7610b00f0fb6.tar.bz2
ayatana-ido-0573203124f66f826a0f6b06262f7610b00f0fb6.zip
{tests/,}CMakeLists.txt: Add ENABLE_COVERAGE build option.
-rw-r--r--CMakeLists.txt8
-rw-r--r--tests/CMakeLists.txt8
2 files changed, 13 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb0cce1..7d2726b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,14 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
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()
# Check for prerequisites
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1ecf8e6..69bc291 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -7,7 +7,9 @@ target_include_directories("gtest-menuitems" PUBLIC "${CMAKE_SOURCE_DIR}/src")
add_test("gtest-menuitems" "gtest-menuitems")
target_link_libraries("gtest-menuitems" ${PROJECT_DEPS_LIBRARIES} "-L${CMAKE_BINARY_DIR}/src" -layatana-ido3-0.4 gtest_main)
-# coverage
-find_package(CoverageReport)
-ENABLE_COVERAGE_REPORT(TARGETS "gtest-menuitems" TESTS "gtest-menuitems")
+# coverage
+if (ENABLE_COVERAGE)
+ find_package(CoverageReport)
+ ENABLE_COVERAGE_REPORT(TARGETS "gtest-menuitems" TESTS "gtest-menuitems")
+endif()