From 82d873933f3aef190b139c4f3ff903c41808c0f5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 29 Apr 2021 08:43:28 +0200 Subject: CMakeLists.txt: Adjust test build option (DISABLE_TESTS -> ENABLE_TESTS, defaulting to OFF). Add ENABLE_COVERAGE build option. --- CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') 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() -- cgit v1.2.3 From 298f4b37043e0921761c8242cabd762d1014c771 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 29 Apr 2021 09:07:03 +0200 Subject: CMakeLists.txt: Be happy with cmake 3.13 (fixes FTBFS on Debian 10). --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index ce7ab46..aaeb591 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ project (libayatana-common C CXX) -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.13) set(PROJECT_VERSION "0.9.1") set(PACKAGE ${CMAKE_PROJECT_NAME}) -- cgit v1.2.3