aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-08-03 23:05:47 +0200
committerRobert Tari <robert@tari.in>2021-08-03 23:05:47 +0200
commit994baa43aec99fdbe79df98f5cf8d98a2d727fab (patch)
treeb5eceb6994befd6f5394ff61bd9bdbd723267d6b
parent8386de05073b9e38ec20625a7cd2b8396a3b64cf (diff)
downloadlibayatana-common-994baa43aec99fdbe79df98f5cf8d98a2d727fab.tar.gz
libayatana-common-994baa43aec99fdbe79df98f5cf8d98a2d727fab.tar.bz2
libayatana-common-994baa43aec99fdbe79df98f5cf8d98a2d727fab.zip
Add ENABLE_WERROR CMake option
-rw-r--r--CMakeLists.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 634bd55..d72cae2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,7 @@ set(ABI_VERSION 0)
# 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)
@@ -22,6 +23,10 @@ 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()
# GNU standard installation directories
include (GNUInstallDirs)
@@ -68,3 +73,4 @@ endif()
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Unit tests: ${ENABLE_TESTS}")
+message(STATUS "Build with -Werror: ${ENABLE_WERROR}")