From dc52487d31b11c073838b369de80afa3b0e03575 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 14 Apr 2026 02:30:40 +0200 Subject: [PATCH] Make `-Wformat` non-fatal on MinGW See the comment for a rationale. --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 62702d3f..c46928da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,6 +163,14 @@ else() -Wno-type-limits -Wno-tautological-constant-out-of-range-compare -Wvla) # MSVC does not support VLAs endif() + + if(MINGW) + # MinGW warns about format specifiers like `%z` and `%j`, which are missing on Windows XP and earlier. + # We rely on runtimes more modern than that, so we can ignore those warnings. + # If this is a problem for you: use Microsoft's equivalents, or define `__USE_MINGW_ANSI_STDIO=1`. + # https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/ + add_compile_options(-Wno-error=format -Wno-error=format-extra-args) + endif() endif() add_subdirectory(src)