[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32674] trunk/blender: Added CMake macro REMOVE_STRICT_FLAGS(), this means developers can build with -Werror in their CMAKE_C_FLAGS_DEBUG (so all warnings give errors).
Campbell Barton
ideasman42 at gmail.com
Sun Oct 24 05:57:07 CEST 2010
Revision: 32674
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32674
Author: campbellbarton
Date: 2010-10-24 05:57:07 +0200 (Sun, 24 Oct 2010)
Log Message:
-----------
Added CMake macro REMOVE_STRICT_FLAGS(), this means developers can build with -Werror in their CMAKE_C_FLAGS_DEBUG (so all warnings give errors).
but external libs which we don't maintain & generated code will have -Werror removed.
This is GCC only, MSVC can be added easily.
Modified Paths:
--------------
trunk/blender/build_files/cmake/macros.cmake
trunk/blender/extern/CMakeLists.txt
trunk/blender/source/blender/makesrna/intern/CMakeLists.txt
trunk/blender/source/blender/render/CMakeLists.txt
trunk/blender/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
Modified: trunk/blender/build_files/cmake/macros.cmake
===================================================================
--- trunk/blender/build_files/cmake/macros.cmake 2010-10-24 02:02:37 UTC (rev 32673)
+++ trunk/blender/build_files/cmake/macros.cmake 2010-10-24 03:57:07 UTC (rev 32674)
@@ -238,7 +238,42 @@
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)
STRING(REGEX REPLACE "\n" ";" CONTENT "${CONTENT}")
Modified: trunk/blender/extern/CMakeLists.txt
===================================================================
--- trunk/blender/extern/CMakeLists.txt 2010-10-24 02:02:37 UTC (rev 32673)
+++ trunk/blender/extern/CMakeLists.txt 2010-10-24 03:57:07 UTC (rev 32674)
@@ -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)
Modified: trunk/blender/source/blender/makesrna/intern/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/makesrna/intern/CMakeLists.txt 2010-10-24 02:02:37 UTC (rev 32673)
+++ trunk/blender/source/blender/makesrna/intern/CMakeLists.txt 2010-10-24 03:57:07 UTC (rev 32674)
@@ -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")
Modified: trunk/blender/source/blender/render/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/render/CMakeLists.txt 2010-10-24 02:02:37 UTC (rev 32673)
+++ trunk/blender/source/blender/render/CMakeLists.txt 2010-10-24 03:57:07 UTC (rev 32674)
@@ -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
Modified: trunk/blender/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
===================================================================
--- trunk/blender/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt 2010-10-24 02:02:37 UTC (rev 32673)
+++ trunk/blender/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt 2010-10-24 03:57:07 UTC (rev 32674)
@@ -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
.
More information about the Bf-blender-cvs
mailing list