aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-08-05 00:30:33 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-05 08:11:54 +0200
commit49571a647dcba45ee5a10e9609fe033dadfa6a8a (patch)
treea95c14c6c88199c828bd116968010c946f1818da
parent28a25ffce39c2c47cd195208594a8b704097f0cf (diff)
downloadayatana-indicator-sound-49571a647dcba45ee5a10e9609fe033dadfa6a8a.tar.gz
ayatana-indicator-sound-49571a647dcba45ee5a10e9609fe033dadfa6a8a.tar.bz2
ayatana-indicator-sound-49571a647dcba45ee5a10e9609fe033dadfa6a8a.zip
Add standard Ayatana CMake bits
-rw-r--r--CMakeLists.txt45
1 files changed, 36 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 49c193f..760983b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,9 @@
project(ayatana-indicator-sound C CXX)
-cmake_minimum_required(VERSION 2.8.9)
+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)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
@@ -9,7 +13,22 @@ find_package(PkgConfig REQUIRED)
include(GNUInstallDirs)
include(UseVala)
-option (enable_tests "Build the package's automatic tests." ON)
+# Options
+option(ENABLE_TESTS "Enable all tests and checks" OFF)
+option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF)
+option(ENABLE_WERROR "Treat all build warnings as errors" OFF)
+
+if(ENABLE_COVERAGE)
+ set(ENABLE_TESTS ON)
+ set(CMAKE_BUILD_TYPE "Coverage")
+else()
+ set(CMAKE_BUILD_TYPE "Release")
+endif()
+
+if(ENABLE_WERROR)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
+endif()
set(GETTEXT_PACKAGE "ayatana-indicator-sound")
set(LOCALEDIR "${CMAKE_INSTALL_FULL_LOCALEDIR}")
@@ -77,14 +96,22 @@ add_subdirectory(data)
add_subdirectory(src)
add_subdirectory(po)
-if (${enable_tests})
+if (ENABLE_TESTS)
pkg_check_modules(TEST REQUIRED dbustest-1>=15.04.0)
enable_testing()
add_subdirectory(tests)
- find_package(CoverageReport)
- ENABLE_COVERAGE_REPORT(
- TARGETS ${COVERAGE_TARGETS}
- TESTS ${COVERAGE_TEST_TARGETS}
- FILTER /usr/include ${CMAKE_BINARY_DIR}/*
- )
+ if (ENABLE_COVERAGE)
+ find_package(CoverageReport)
+ ENABLE_COVERAGE_REPORT(
+ TARGETS ${COVERAGE_TARGETS}
+ TESTS ${COVERAGE_TEST_TARGETS}
+ FILTER /usr/include ${CMAKE_BINARY_DIR}/*
+ )
+ endif()
endif ()
+
+# Display config info
+
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "Unit tests: ${ENABLE_TESTS}")
+message(STATUS "Build with -Werror: ${ENABLE_WERROR}")