From: Hajin Jang Date: Mon, 25 Sep 2023 17:15:10 +0000 (+0900) Subject: Detect -Wno-pedantic-ms-format support in mingw X-Git-Tag: 2.1.4~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6139b349108f40f1b570e7ed49102d46e284a9d;p=thirdparty%2Fzlib-ng.git Detect -Wno-pedantic-ms-format support in mingw Use check_c_compiler_flag() feature of CMake to figure out whether this mingw toolchain has support for -Wno-pedantic-ms-format or not. This flag will be added only if the toolchain supports it. Currently, MinGW-w64 GCC has it, and llvm-mingw does not have it. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b53e8c8..974af49c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,9 +239,9 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") endif() endif() if(MINGW) - # Add `-Wno-pedantic-ms-format` only if the toolchain is GCC MinGW-w64 - # llvm-mingw does not support '-Wno-pedantic-ms-format' - if(CMAKE_C_COMPILER_ID MATCHES "GNU") + # Add `-Wno-pedantic-ms-format` only if the toolchain supports it + check_c_compiler_flag(-Wno-pedantic-ms-format HAVE_NO_PEDANTIC_MS_FORMAT) + if(HAVE_NO_PEDANTIC_MS_FORMAT) list(APPEND WARNFLAGS_DISABLE -Wno-pedantic-ms-format) endif() endif()