From ab1fb44f94511de31ad319ce22cdb7a8f9397e8a Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 18 Jun 2021 01:42:57 +0200 Subject: Add all Ayatana standard CMakeLists.txt bits fixes https://github.com/AyatanaIndicators/ayatana-indicator-datetime/issues/36 --- CMakeLists.txt | 18 +++++++++++++++--- cmake/GdbusCodegen.cmake | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dce8c96..1ff9bf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ project (ayatana-indicator-datetime C CXX) -cmake_minimum_required (VERSION 2.8.9) +cmake_minimum_required (VERSION 3.13) list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) @@ -9,8 +9,15 @@ endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set (PROJECT_VERSION "0.8.3") set (PACKAGE ${CMAKE_PROJECT_NAME}) -option (ENABLE_TESTS "Build the package's automatic tests." OFF) -option (ENABLE_COVERAGE "Generate lcov code coverage reports." OFF) +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 @@ -134,3 +141,8 @@ add_subdirectory(po) if (${ENABLE_TESTS}) add_subdirectory(tests) endif () + +# Display config info + +message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "Unit tests: ${ENABLE_TESTS}") diff --git a/cmake/GdbusCodegen.cmake b/cmake/GdbusCodegen.cmake index ddb2995..5261ba8 100644 --- a/cmake/GdbusCodegen.cmake +++ b/cmake/GdbusCodegen.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 3.13) if(POLICY CMP0011) cmake_policy(SET CMP0011 NEW) endif(POLICY CMP0011) -- cgit v1.2.3