cmake: Fix not detecting unsupported g++ related warning checks

Unsupported warnings are detected by cmake through errors during
compilation, which causes g++ not to detect them, since they are
only output as warnings. Setting -Werror ensures this.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
This commit is contained in:
Ralf Habacker 2022-04-07 13:53:42 +02:00 committed by Simon McVittie
parent 4b73505869
commit bbd3f90a8d

View file

@ -124,6 +124,8 @@ include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
function(check_compiler_warning_flag _flag _result _cxx)
string(MAKE_C_IDENTIFIER "${_flag}" _varname)
# required to get errors
list(APPEND _flag -Werror)
if (_cxx)
check_cxx_compiler_flag("${_flag}" HAVE_CXX_FLAG${_varname})
set(${_result} ${HAVE_CXX_FLAG${_varname}} PARENT_SCOPE)