From: Ralf Habacker Date: Thu, 7 Apr 2022 11:55:26 +0000 (+0200) Subject: cmake: Fix detecting -Wformat-* warnings for gcc X-Git-Tag: dbus-1.15.0~66^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb5449e08f063f031bd3423a4c6af12ab5f492c6;p=thirdparty%2Fdbus.git cmake: Fix detecting -Wformat-* warnings for gcc gcc expects -Wformat to be set along with these type of warnings. Signed-off-by: Ralf Habacker --- diff --git a/cmake/modules/Macros.cmake b/cmake/modules/Macros.cmake index 04ee287d3..c3c057e6f 100644 --- a/cmake/modules/Macros.cmake +++ b/cmake/modules/Macros.cmake @@ -126,6 +126,9 @@ function(check_compiler_warning_flag _flag _result _cxx) string(MAKE_C_IDENTIFIER "${_flag}" _varname) # required to get errors list(APPEND _flag -Werror) + if(_flag MATCHES "-Wformat-.*") + list(APPEND _flag -Wformat) + endif() if (_cxx) check_cxx_compiler_flag("${_flag}" HAVE_CXX_FLAG${_varname}) set(${_result} ${HAVE_CXX_FLAG${_varname}} PARENT_SCOPE)