Merge branch 'master' into blender2.8
[blender.git] / build_files / cmake / macros.cmake
index 8cf90d0d22c662ae4686e16b94eae1e6e7edce57..d6fde945173b6ef28ef3973a4d745a91ccc12647 100644 (file)
@@ -1054,13 +1054,19 @@ macro(remove_cc_flag
 
 endmacro()
 
-macro(add_cc_flag
+macro(add_c_flag
        flag)
 
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
 endmacro()
 
+macro(add_cxx_flag
+       flag)
+
+       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+endmacro()
+
 macro(remove_strict_flags)
 
        if(CMAKE_COMPILER_IS_GNUCC)
@@ -1083,7 +1089,8 @@ macro(remove_strict_flags)
                )
 
                # negate flags implied by '-Wall'
-               add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
+               add_c_flag("${C_REMOVE_STRICT_FLAGS}")
+               add_cxx_flag("${CXX_REMOVE_STRICT_FLAGS}")
        endif()
 
        if(CMAKE_C_COMPILER_ID MATCHES "Clang")
@@ -1095,7 +1102,8 @@ macro(remove_strict_flags)
                )
 
                # negate flags implied by '-Wall'
-               add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
+               add_c_flag("${C_REMOVE_STRICT_FLAGS}")
+               add_cxx_flag("${CXX_REMOVE_STRICT_FLAGS}")
        endif()
 
        if(MSVC)
@@ -1125,28 +1133,39 @@ endmacro()
 # note, we can only append flags on a single file so we need to negate the options.
 # at the moment we cant shut up ffmpeg deprecations, so use this, but will
 # probably add more removals here.
-macro(remove_strict_flags_file
+macro(remove_strict_c_flags_file
        filenames)
-
        foreach(_SOURCE ${ARGV})
-
                if(CMAKE_COMPILER_IS_GNUCC OR
                  (CMAKE_C_COMPILER_ID MATCHES "Clang"))
-
                        set_source_files_properties(${_SOURCE}
                                PROPERTIES
-                                       COMPILE_FLAGS "${CC_REMOVE_STRICT_FLAGS}"
+                                       COMPILE_FLAGS "${C_REMOVE_STRICT_FLAGS}"
                        )
                endif()
-
                if(MSVC)
                        # TODO
                endif()
-
        endforeach()
-
        unset(_SOURCE)
+endmacro()
 
+macro(remove_strict_cxx_flags_file
+       filenames)
+       remove_strict_c_flags_file(${filenames} ${ARHV})
+       foreach(_SOURCE ${ARGV})
+               if(CMAKE_COMPILER_IS_GNUCC OR
+                 (CMAKE_C_COMPILER_ID MATCHES "Clang"))
+                       set_source_files_properties(${_SOURCE}
+                               PROPERTIES
+                                       COMPILE_FLAGS "${C_REMOVE_STRICT_FLAGS}"
+                       )
+               endif()
+               if(MSVC)
+                       # TODO
+               endif()
+       endforeach()
+       unset(_SOURCE)
 endmacro()
 
 # External libs may need 'signed char' to be default.