summaryrefslogtreecommitdiff
path: root/Modules/CMakeDetermineCompilerABI.cmake
diff options
context:
space:
mode:
authorDavid Rohr <drohr@jwdt.org>2020-01-30 23:29:56 +0100
committerBrad King <brad.king@kitware.com>2020-02-03 17:01:35 -0500
commitd5895f50c30d9d0d329d23013baf7986d62e00f1 (patch)
treeb1527e2acd5c14a6d24b251f2aa22daa43ee3c0a /Modules/CMakeDetermineCompilerABI.cmake
parent3a732a7dc3a2f48f824175ad4727706a14974929 (diff)
downloadcmake-d5895f50c30d9d0d329d23013baf7986d62e00f1.tar.gz
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
Diffstat (limited to 'Modules/CMakeDetermineCompilerABI.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 99447e41eb..e1b3c523c2 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -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.