diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-24 07:57:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-24 07:57:07 +0400 |
commit | c7ff23cc34e67e0c8f292fe19c4af4af05b15f1c (patch) | |
tree | 7d1042471c76dc5ea79c9dad427318d9b6083536 /build_files/cmake/macros.cmake | |
parent | ea5670f4b597828bfb0170f9b659d19ebdb5ab33 (diff) |
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.
Diffstat (limited to 'build_files/cmake/macros.cmake')
-rw-r--r-- | build_files/cmake/macros.cmake | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 9237f01a950..afd5f302314 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -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) |