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 9237f01a950aefce8cca1f7a05faf90d0273b49c..afd5f3023148ab8003d7774e0eecd4ceab6e0479 100644 (file)
@@ -238,6 +238,41 @@ MACRO(TEST_SSE_SUPPORT)
 
 ENDMACRO(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)
 
 MACRO(GET_BLENDER_VERSION)
        FILE(READ ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h CONTENT)
index 61acff4cfe42d24a108c2813c55c1625c75f132a..1dc610cc1b42b1979627881d7ce9c7f4de7b6a0e 100644 (file)
@@ -25,7 +25,7 @@
 # ***** END GPL LICENSE BLOCK *****
 
 # Otherwise we get warnings here that we cant fix in external projects
 # ***** 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)
 
 IF(WITH_BULLET)
        ADD_SUBDIRECTORY(bullet2)
index 97e16bba057dd29e44820279fe43afd8b4c6485f..5fd7ae1bd8a65b958faa37c7d786b8ff9a71612e 100644 (file)
@@ -24,8 +24,8 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
 #
 # ***** 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")
 
 FILE(GLOB DEFSRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
 FILE(GLOB APISRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_api.c")
index f2da8f4d13e37b8102872218034b1385163c9140..bed48a3fd1770477227394a151bdc7a6f493e461 100644 (file)
@@ -25,7 +25,7 @@
 # ***** END GPL LICENSE BLOCK *****
 
 # remove warning until render branch merged.
 # ***** 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
 
 SET(INC 
        intern/include
index a40c0f1972580d30ea90ee37ea16b1ec30ce75fc..a242c8b75512d761c015c3fd8ed0afab721812a3 100644 (file)
@@ -25,7 +25,7 @@
 # ***** END GPL LICENSE BLOCK *****
 
 # this warning on generated files gets annoying
 # ***** 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 
        .
 
 SET(INC 
        .