aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-04 12:18:42 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-04 12:18:42 +0200
commit6dc8e402200927d298ff63fe34e1c9a06a2e07e0 (patch)
tree54e9e03a866375e73feaa363c9ae6f1fe377f6bc
parentf30807b99c971673b4f12702ec139fb6ec1686b3 (diff)
parentc59cc9740cde72f6e386ac3a47e04d4cbe4aead6 (diff)
downloadayatana-indicator-keyboard-6dc8e402200927d298ff63fe34e1c9a06a2e07e0.tar.gz
ayatana-indicator-keyboard-6dc8e402200927d298ff63fe34e1c9a06a2e07e0.tar.bz2
ayatana-indicator-keyboard-6dc8e402200927d298ff63fe34e1c9a06a2e07e0.zip
Merge branch 'tari01-pr/add-standard-ayatana-cmake-bits'
Attributes GH PR #12: https://github.com/AyatanaIndicators/ayatana-indicator-keyboard/pull/12
-rw-r--r--CMakeLists.txt39
1 files changed, 36 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ee15b45e..191e3921 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,25 @@
project(ayatana-indicator-keyboard C CXX)
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.13)
+
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ SET(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
+endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set(PROJECT_VERSION "0.7.901")
set(PACKAGE ${CMAKE_PROJECT_NAME})
+# 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
include (GNUInstallDirs)
set (CMAKE_INSTALL_PKGLIBEXECDIR "${CMAKE_INSTALL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
@@ -34,14 +50,31 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
else()
- set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wall -Wformat=2")
+ set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wall")
endif()
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories (${CMAKE_CURRENT_BINARY_DIR}/include)
-# actually build things
add_subdirectory(src)
add_subdirectory(data)
add_subdirectory(po)
+
+# Test and coverage
+if (ENABLE_TESTS)
+
+ include(CTest)
+ enable_testing()
+
+ if (ENABLE_COVERAGE)
+
+ find_package(CoverageReport)
+
+ endif()
+
+endif()
+
+# Display config info
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "Unit tests: ${ENABLE_TESTS}")