SDL_image: Add MinGW cmake config file for redist SDK

From fcf24b219d4bc319ea80fea3a36c8d6aecef5e4d Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sat, 4 Jun 2022 02:58:01 +0200
Subject: [PATCH] Add MinGW cmake config file for redist SDK

---
 .../cmake/sdl2_image-config-version.cmake     | 19 +++++++++++++++++++
 .../pkg-support/cmake/sdl2_image-config.cmake | 19 +++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 mingw/pkg-support/cmake/sdl2_image-config-version.cmake
 create mode 100644 mingw/pkg-support/cmake/sdl2_image-config.cmake

diff --git a/mingw/pkg-support/cmake/sdl2_image-config-version.cmake b/mingw/pkg-support/cmake/sdl2_image-config-version.cmake
new file mode 100644
index 00000000..c37baed2
--- /dev/null
+++ b/mingw/pkg-support/cmake/sdl2_image-config-version.cmake
@@ -0,0 +1,19 @@
+# SDL2_image CMake version configuration file:
+# This file is meant to be placed in a cmake subfolder of SDL2_image-devel-2.x.y-mingw
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+    set(sdl2_image_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2_image/sdl2_image-config-version.cmake")
+elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    set(sdl2_image_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2_image/sdl2_image-config-version.cmake")
+else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
+    set(PACKAGE_VERSION_UNSUITABLE TRUE)
+    return()
+endif()
+
+if(NOT EXISTS "${sdl2_image_config_path}")
+    message(WARNING "${sdl2_image_config_path} does not exist: MinGW development package is corrupted")
+    set(PACKAGE_VERSION_UNSUITABLE TRUE)
+    return()
+endif()
+
+include("${sdl2_image_config_path}")
diff --git a/mingw/pkg-support/cmake/sdl2_image-config.cmake b/mingw/pkg-support/cmake/sdl2_image-config.cmake
new file mode 100644
index 00000000..8e68d757
--- /dev/null
+++ b/mingw/pkg-support/cmake/sdl2_image-config.cmake
@@ -0,0 +1,19 @@
+# SDL2_image CMake configuration file:
+# This file is meant to be placed in a cmake subfolder of SDL2_image-devel-2.x.y-mingw
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+    set(sdl2_image_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2_image/sdl2-image-config.cmake")
+elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    set(sdl2_image_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2_image/sdl2-image-config.cmake")
+else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
+    set(SDL2_image_FOUND FALSE)
+    return()
+endif()
+
+if(NOT EXISTS "${sdl2_image_config_path}")
+    message(WARNING "${sdl2_image_config_path} does not exist: MinGW development package is corrupted")
+    set(SDL2_image_FOUND FALSE)
+    return()
+endif()
+
+include("${sdl2_image_config_path}")