gnucash unstable: Bug 792883 - cmake: no way to turn off -Werror

John Ralls jralls at code.gnucash.org
Tue Feb 13 17:13:36 EST 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/da0df1c4 (commit)
	from  https://github.com/Gnucash/gnucash/commit/849b236f (commit)



commit da0df1c48dbf706b1cec7843ebad583625764204
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Feb 13 14:11:44 2018 -0800

    Bug 792883 - cmake: no way to turn off -Werror
    
    Prepend settings to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS so that values
    supplied on the command line can override the fixed settings.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ecaf705..da1858d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -510,9 +510,9 @@ if (APPLE)
   include (CheckCxxCompilerFlag)
   Check_CXX_Compiler_Flag(-Wno-unused-local-typedef, have_wno_ult)
   if (have_wno_ult)
-    SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedef -Wmissing-prototypes")
+    SET( CMAKE_CXX_FLAGS "-Wno-unused-local-typedef -Wmissing-prototypes ${CMAKE_CXX_FLAGS}")
   else()
-    SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-prototypes")
+    SET( CMAKE_CXX_FLAGS "-Wmissing-prototypes ${CMAKE_CXX_FLAGS}")
   endif()
   Check_C_Compiler_Flag(-Wno-unknown-attributes have_no_unkatt)
   if (have_no_unkatt)
@@ -525,22 +525,22 @@ endif (APPLE)
 
 
 # Also, set the C++ version to c++11
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")  # FIXME: should be -std=c++11
+SET(CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}")  # FIXME: should be -std=c++11
 
 
 IF (UNIX)
-  SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-unused")
-  SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wmissing-declarations -Wno-unused")
-  SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations -std=gnu11")
-  SET( CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2")
+  SET( CMAKE_C_FLAGS "-Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-unused ${CMAKE_C_FLAGS}")
+  SET( CMAKE_CXX_FLAGS "-Werror -Wall -Wmissing-declarations -Wno-unused ${CMAKE_CXX_FLAGS}")
+  SET( CMAKE_C_FLAGS "-Wno-deprecated-declarations -std=gnu11 ${CMAKE_C_FLAGS}")
+  SET( CMAKE_C_FLAGS_RELEASE "-O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${CMAKE_C_FLAGS}")
 ENDIF (UNIX)
 IF (MINGW)
-  SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations  -Wno-unused -Wno-error=deprecated-declarations -std=gnu11")
-  SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0500 -D_EMULATE_GLIBC=0") # Workaround for bug in gtest on mingw, see https://github.com/google/googletest/issues/893 and https://github.com/google/googletest/issues/920
+  SET( CMAKE_C_FLAGS "-Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations  -Wno-unused -Wno-error=deprecated-declarations -std=gnu11 ${CMAKE_C_FLAGS}")
+  SET( CMAKE_CXX_FLAGS "-DWINVER=0x0500 -D_EMULATE_GLIBC=0 ${CMAKE_CXX_FLAGS}") # Workaround for bug in gtest on mingw, see https://github.com/google/googletest/issues/893 and https://github.com/google/googletest/issues/920
 ENDIF (MINGW)
 
 SET( CMAKE_C_FLAGS_DEBUG "-O0 -g ${CMAKE_C_FLAGS}")
-SET( CMAKE_CXX_FLAGS_DEBUG "-O0 -g ${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
+SET( CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wno-deprecated-declarations ${CMAKE_CXX_FLAGS}")
 
 IF (APPLE AND WITH_GNUCASH)
   SET(CMAKE_MACOSX_RPATH ON)



Summary of changes:
 CMakeLists.txt | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)



More information about the gnucash-changes mailing list