diff options
author | Robert Tari <robert@tari.in> | 2021-07-29 00:47:29 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2021-07-29 00:47:29 +0200 |
commit | c59cc9740cde72f6e386ac3a47e04d4cbe4aead6 (patch) | |
tree | 54e9e03a866375e73feaa363c9ae6f1fe377f6bc /CMakeLists.txt | |
parent | f30807b99c971673b4f12702ec139fb6ec1686b3 (diff) | |
download | ayatana-indicator-keyboard-c59cc9740cde72f6e386ac3a47e04d4cbe4aead6.tar.gz ayatana-indicator-keyboard-c59cc9740cde72f6e386ac3a47e04d4cbe4aead6.tar.bz2 ayatana-indicator-keyboard-c59cc9740cde72f6e386ac3a47e04d4cbe4aead6.zip |
Add standard Ayatana CMake bits
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 39 |
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}") |