diff options
author | Sung, Po Han <bernies@synology.com> | 2024-03-28 02:47:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-03-28 17:16:18 (GMT) |
commit | e60281e9687d5192bb4f804d0194ad4d3a4a619e (patch) | |
tree | dc5708c01bf55c62168a729e22fd83a4cd0bab5b /Modules | |
parent | 6abd25e7fd70ed1ac38cfc8ce9a5a8c7b05f7c51 (diff) | |
download | CMake-e60281e9687d5192bb4f804d0194ad4d3a4a619e.zip CMake-e60281e9687d5192bb4f804d0194ad4d3a4a619e.tar.gz CMake-e60281e9687d5192bb4f804d0194ad4d3a4a619e.tar.bz2 |
CMakeDetermineCompilerABI: Remove -Werror from per-config flags
Extend the fixes from
* commit 079ea66468 (CMakeDetermineCompilerABI: Handle NVCC-style -Werror
flags, 2020-10-04, v3.19.0-rc1~45^2), and
* commit cec6f98018 (CMakeDetermineCompilerABI: Avoid removing the flag
after -Werror, 2023-05-29, v3.26.5~4^2)
to apply to the per-config flags propagated by CMP0066's NEW behavior.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCompilerABI.cmake | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 012a87c..cb2162c 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -50,7 +50,14 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) __TestCompiler_setTryCompileTargetType() # Avoid failing ABI detection on warnings. - string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}") + if(CMAKE_TRY_COMPILE_CONFIGURATION) + string(TOUPPER "${CMAKE_TRY_COMPILE_CONFIGURATION}" _tc_config) + else() + set(_tc_config "DEBUG") + endif() + foreach(v CMAKE_${lang}_FLAGS CMAKE_${lang}_FLAGS_${_tc_config}) + string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " ${v} "${${v}}") + endforeach() # 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 |