aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-08-09 22:21:29 +0200
committerRobert Tari <robert@tari.in>2021-08-09 22:23:21 +0200
commit8d3a18b677bba9ea31c0475fb9ac2cf43a841a7e (patch)
treebae950ff5964537c518b38216ab0520c0ddf1238 /CMakeLists.txt
parentc173a0e1b4b77db77175b30ed293b0923e7ee938 (diff)
downloadlibayatana-appindicator-8d3a18b677bba9ea31c0475fb9ac2cf43a841a7e.tar.gz
libayatana-appindicator-8d3a18b677bba9ea31c0475fb9ac2cf43a841a7e.tar.bz2
libayatana-appindicator-8d3a18b677bba9ea31c0475fb9ac2cf43a841a7e.zip
Add ENABLE_WERROR option
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt17
1 files changed, 13 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c28eab1..6b439f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,12 +7,11 @@ endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+# Options
+
option(ENABLE_TESTS "Enable all tests and checks" OFF)
option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF)
-
-# Check for prerequisites
-
-set(DEPS glib-2.0>=2.58 ayatana-indicator3-0.4>=0.8.4 gtk+-3.0>=3.24 dbusmenu-gtk3-0.4)
+option(ENABLE_WERROR "Treat all build warnings as errors" OFF)
if(ENABLE_COVERAGE)
set(ENABLE_TESTS ON)
@@ -21,6 +20,15 @@ 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()
+
+# Check for prerequisites
+
+set(DEPS glib-2.0>=2.58 ayatana-indicator3-0.4>=0.8.4 gtk+-3.0>=3.24 dbusmenu-gtk3-0.4)
+
if(ENABLE_TESTS)
set(DEPS ${DEPS} dbus-1>=1.12 dbus-glib-1>=0.82)
endif()
@@ -72,3 +80,4 @@ endif()
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Unit tests: ${ENABLE_TESTS}")
+message(STATUS "Build with -Werror: ${ENABLE_WERROR}")