diff options
Diffstat (limited to 'build_files/cmake/macros.cmake')
-rw-r--r-- | build_files/cmake/macros.cmake | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index e4665124c8f..8e5d914948b 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1,5 +1,4 @@ # -*- mode: cmake; indent-tabs-mode: t; -*- -# $Id$ # foo_bar.spam --> foo_barMySuffix.spam @@ -17,7 +16,7 @@ macro(file_suffix unset(_file_name_EXT) endmacro() -# usefil for adding debug suffix to library lists: +# useful for adding debug suffix to library lists: # /somepath/foo.lib --> /somepath/foo_d.lib macro(file_list_suffix fp_list_new fp_list fn_suffix @@ -378,7 +377,7 @@ endmacro() # needs to be removed for some external libs which we dont maintain. # utility macro -macro(remove_flag +macro(remove_cc_flag flag) string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") @@ -395,16 +394,27 @@ macro(remove_flag endmacro() +macro(add_cc_flag + flag) + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") +endmacro() + macro(remove_strict_flags) if(CMAKE_COMPILER_IS_GNUCC) - remove_flag("-Wstrict-prototypes") - remove_flag("-Wunused-parameter") - remove_flag("-Wwrite-strings") - remove_flag("-Wundef") - remove_flag("-Wshadow") - remove_flag("-Werror=[^ ]+") - remove_flag("-Werror") + remove_cc_flag("-Wstrict-prototypes") + remove_cc_flag("-Wunused-parameter") + remove_cc_flag("-Wwrite-strings") + remove_cc_flag("-Wundef") + remove_cc_flag("-Wshadow") + remove_cc_flag("-Werror=[^ ]+") + remove_cc_flag("-Werror") + + # negate flags implied by '-Wall' + add_cc_flag("-Wno-unused-parameter") + add_cc_flag("-Wno-unused-but-set-variable") endif() if(MSVC) @@ -413,6 +423,32 @@ macro(remove_strict_flags) 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 + filenames) + + foreach(_SOURCE ${ARGV}) + + if(CMAKE_COMPILER_IS_GNUCC) + set_source_files_properties(${_SOURCE} + PROPERTIES + COMPILE_FLAGS "-Wno-deprecated-declarations" + ) + endif() + + if(MSVC) + # TODO + endif() + + endforeach() + + unset(_SOURCE) + +endmacro() + + macro(ADD_CHECK_C_COMPILER_FLAG _CFLAGS _CACHE_VAR |