SDL: cmake: Add CMake configuration files, meant for the prebuilt MinGW SDK

From 67792767f56529241bf4a98a26f7bc03d9a1578a Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 3 Jun 2022 20:06:09 +0200
Subject: [PATCH] cmake: Add CMake configuration files, meant for the prebuilt
 MinGW SDK

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

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