CheckSymbolExists: Avoid removing the flag after -Werror

In commit 1ab7c3cd28 (CheckSymbolExists: Work around GCC failure with
-pedantic-errors option, 2021-10-22, v3.23.0-rc1~498^2) we used the same
code that was fixed by commit cec6f98018 (CMakeDetermineCompilerABI:
Avoid removing the flag after -Werror, 2023-05-29, v3.26.5~4^2).
Apply the fix to CheckSymbolExists too.
This commit is contained in:
Sung, Po Han
2024-03-28 10:58:07 +08:00
committed by Brad King
parent e60281e968
commit 06c99ce73b

View File

@@ -76,7 +76,7 @@ endmacro()
macro(__CHECK_SYMBOL_EXISTS_FILTER_FLAGS LANG)
set(__CMAKE_${LANG}_FLAGS_SAVED "${CMAKE_${LANG}_FLAGS}")
string(REGEX REPLACE "(^| )-Werror([= ][^ ]*)?( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}")
string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}")
string(REGEX REPLACE "(^| )-pedantic-errors( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}")
endmacro()