changeset 1406:deaa89f4a994

add ERRORS_ON_WARNINGS to enable fatal compiler warnings
author Luke Mewburn <luke@mewburn.net>
date Tue, 18 Feb 2020 16:48:26 +1100
parents 3cbe458fbfa9
children d4a4ab5239c7
files CMakeLists.txt include/freeDiameter/CMakeLists.txt
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Feb 18 16:23:53 2020 +1100
+++ b/CMakeLists.txt	Tue Feb 18 16:48:26 2020 +1100
@@ -71,6 +71,11 @@
   SET(DEBUG 1)
 ENDIF (CMAKE_BUILD_TYPE MATCHES "Debug|Profiling|DebugValgrind")
 
+# Build with fatal warnings?
+IF (ERRORS_ON_WARNINGS)
+  SET(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}")
+ENDIF (ERRORS_ON_WARNINGS)
+
 # some subfolders use yacc and lex parsers
 SET(BISON_GENERATE_DEFINES TRUE)
 SET(BISON_PREFIX_OUTPUTS TRUE)
@@ -109,4 +114,3 @@
 IF ( BUILD_TESTING )
 	SUBDIRS(tests)
 ENDIF ( BUILD_TESTING )
-
--- a/include/freeDiameter/CMakeLists.txt	Tue Feb 18 16:23:53 2020 +1100
+++ b/include/freeDiameter/CMakeLists.txt	Tue Feb 18 16:48:26 2020 +1100
@@ -15,6 +15,9 @@
 # Find TODO items in the code easily ?
 OPTION(ERRORS_ON_TODO "(development) Generate compilation errors on TODO items ?" OFF)
 
+# Compiler warnings are fatal?
+OPTION(ERRORS_ON_WARNINGS "(development) Compiler warnings cause compilation errors ?" OFF)
+
 # In DEBUG mode, each log can contain pid, calling function and file for easy debug. Set to ON to display this information.
 OPTION(DEBUG_WITH_META "Show calling location in logs?" OFF)
 
"Welcome to our mercurial repository"