aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-04-29 08:43:28 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-04-29 08:43:28 +0200
commit82d873933f3aef190b139c4f3ff903c41808c0f5 (patch)
tree094a31134728972e039c35239ed88aefefd5713b /CMakeLists.txt
parente29071a5de59aa2aec62a2d172df5c0ce19ac917 (diff)
downloadlibayatana-common-82d873933f3aef190b139c4f3ff903c41808c0f5.tar.gz
libayatana-common-82d873933f3aef190b139c4f3ff903c41808c0f5.tar.bz2
libayatana-common-82d873933f3aef190b139c4f3ff903c41808c0f5.zip
CMakeLists.txt: Adjust test build option (DISABLE_TESTS -> ENABLE_TESTS, defaulting to OFF). Add ENABLE_COVERAGE build option.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt17
1 files changed, 13 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c1bffc3..ce7ab46 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,16 @@ set(API_VERSION 0)
set(ABI_VERSION 0)
# Options
-option(DISABLE_TESTS "Disable tests" off)
+option (ENABLE_TESTS "Build the package's automatic tests." OFF)
+option (ENABLE_COVERAGE "Generate lcov code coverage reports." OFF)
+
+if(ENABLE_COVERAGE)
+ set(ENABLE_TESTS ON)
+ set(CMAKE_BUILD_TYPE "Coverage")
+else()
+ set(CMAKE_BUILD_TYPE "Release")
+endif()
+
# GNU standard installation directories
include (GNUInstallDirs)
@@ -34,10 +43,10 @@ set(CC_WARNING_ARGS " -Wall -pedantic -Wextra -Wno-missing-field-initializers")
add_subdirectory(src)
-if (DISABLE_TESTS)
- message(STATUS "Tests disabled")
-else()
+if (ENABLE_TESTS)
include(CTest)
enable_testing()
add_subdirectory(tests)
+else()
+ message(STATUS "Tests disabled")
endif()