From cb616088fdeee1686130052b9e4130a61f4a09bf Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sun, 6 Aug 2023 21:44:07 +0200
Subject: [PATCH] Ignore -Wformat warnings about %z in testautomation_stdib.c
---
CMakeLists.txt | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0cfff85..e9c7280 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -528,6 +528,22 @@ if(SDL2COMPAT_TESTS)
"utf8.txt")
file(COPY "${CMAKE_SOURCE_DIR}/test/${fname}" DESTINATION "${CMAKE_BINARY_DIR}")
endforeach()
+
+ check_c_compiler_flag(-Wformat HAVE_WFORMAT)
+ if(HAVE_WFORMAT)
+ target_compile_definitions(testautomation PRIVATE HAVE_WFORMAT)
+ endif()
+
+ cmake_push_check_state()
+ if(HAVE_WFORMAT)
+ # Some compilers ignore -Wformat-extra-args without -Wformat
+ string(APPEND CMAKE_REQUIRED_FLAGS " -Wformat")
+ endif()
+ check_c_compiler_flag(-Wformat-extra-args HAVE_WFORMAT_EXTRA_ARGS)
+ cmake_pop_check_state()
+ if(HAVE_WFORMAT_EXTRA_ARGS)
+ target_compile_definitions(testautomation PRIVATE HAVE_WFORMAT_EXTRA_ARGS)
+ endif()
endif()
set(installed_targets SDL2)