Some compilers (GCC) produce no diagnostic for -Wno-some-warning
unless other diagnostics are being produced:
0$ git diff
1diff --git a/CMakeLists.txt b/CMakeLists.txt
2index 240557f..f976824 100644
3--- a/CMakeLists.txt
4+++ b/CMakeLists.txt
5@@ -220,6 +220,7 @@ if(MSVC)
6 add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
7 else()
8 # Keep the following commands ordered lexicographically.
9+ try_append_c_flags(-Wno-some-warning)
10 try_append_c_flags(-pedantic)
11 try_append_c_flags(-Wall) # GCC >= 2.95 and probably many other compilers.
12 try_append_c_flags(-Wcast-align) # GCC >= 2.95.
13$ cmake -B build -DCMAKE_C_COMPILER=gcc 2>&1 | grep -i unknown
14-- Performing Test C_SUPPORTS__WNO_SOME_WARNING
15-- Performing Test C_SUPPORTS__WNO_SOME_WARNING - Success
16Compile options ....................... -Wno-some-warning -pedantic -Wall -Wcast-align -Wcast-align=strict -Wextra -Wnested-externs -Wno-long-long -Wno-overlength-strings -Wno-unused-function -Wshadow -Wstrict-prototypes -Wundef
This PR fixes compiler flag check in CMake-based build system.
Let me know, if the same fix is desirable in Autotools-based build system.