Added CMake macro REMOVE_STRICT_FLAGS(), this means developers can build with -Werror...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 24 Oct 2010 03:57:07 +0000 (03:57 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 24 Oct 2010 03:57:07 +0000 (03:57 +0000)
but external libs which we don't maintain & generated code will have -Werror removed.

This is GCC only, MSVC can be added easily.

build_files/cmake/macros.cmake
extern/CMakeLists.txt
source/blender/makesrna/intern/CMakeLists.txt
source/blender/render/CMakeLists.txt
source/blenderplayer/bad_level_call_stubs/CMakeLists.txt

index 9237f01..afd5f30 100644 (file)
@@ -238,6 +238,41 @@ MACRO(TEST_SSE_SUPPORT)
 
 ENDMACRO(TEST_SSE_SUPPORT)
 
+# when we have warnings as errors applied globally this
+# needs to be removed for some external libs which we dont maintain.
+
+# utility macro
+MACRO(_REMOVE_STRICT_FLAGS
+       flag)
+       
+       STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+       STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
+       STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
+       STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_MINSIZEREL})
+       STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
+
+       STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+       STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
+       STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
+       STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL})
+       STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
+
+ENDMACRO(_REMOVE_STRICT_FLAGS)
+
+MACRO(REMOVE_STRICT_FLAGS)
+
+       IF(CMAKE_COMPILER_IS_GNUCC)
+               _REMOVE_STRICT_FLAGS("-Wunused-parameter")
+               _REMOVE_STRICT_FLAGS("-Werror=[^ ]+")
+               _REMOVE_STRICT_FLAGS("-Werror")
+       ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+       IF(MSVC)
+               # TODO
+       ENDIF(MSVC)
+
+ENDMACRO(REMOVE_STRICT_FLAGS)
+
 
 MACRO(GET_BLENDER_VERSION)
        FILE(READ ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h CONTENT)
index 61acff4..1dc610c 100644 (file)
@@ -25,7 +25,7 @@
 # ***** END GPL LICENSE BLOCK *****
 
 # Otherwise we get warnings here that we cant fix in external projects
-STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+REMOVE_STRICT_FLAGS()
 
 IF(WITH_BULLET)
        ADD_SUBDIRECTORY(bullet2)
index 97e16bb..5fd7ae1 100644 (file)
@@ -24,8 +24,8 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
-# this warning on generated files gets annoying
-STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+# Generated code has some unused vars we can ignore.
+REMOVE_STRICT_FLAGS()
 
 FILE(GLOB DEFSRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
 FILE(GLOB APISRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_api.c")
index f2da8f4..bed48a3 100644 (file)
@@ -25,7 +25,7 @@
 # ***** END GPL LICENSE BLOCK *****
 
 # remove warning until render branch merged.
-STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+REMOVE_STRICT_FLAGS()
 
 SET(INC 
        intern/include
index a40c0f1..a242c8b 100644 (file)
@@ -25,7 +25,7 @@
 # ***** END GPL LICENSE BLOCK *****
 
 # this warning on generated files gets annoying
-STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+REMOVE_STRICT_FLAGS()
 
 SET(INC 
        .