CMakeDetermineCompilerABI: Avoid failing on warnings with -Werror

Simply remove `-Werror` flags from `CMAKE_<LANG>_FLAGS` to avoid failing
ABI detection if there happen to be warnings in the test project.  For
example, `-Wunused-command-line-argument` warnings are common since the
ABI detection project may not exercise all the flags passed by users.

Fixes: #20305
This commit is contained in:
David Rohr
2020-01-30 23:29:56 +01:00
committed by Brad King
parent 3a732a7dc3
commit d5895f50c3

View File

@@ -32,6 +32,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
endif()
__TestCompiler_setTryCompileTargetType()
# Avoid failing ABI detection on warnings.
string(REGEX REPLACE "(^| )-Werror(=[^ ]*)?( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}")
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
# and set them to "C" that way GCC's "search starts here" text is in
# English and we can grok it.