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.
1 file changed