SDL: visualc: fix sdl3-config.cmake

From 2ed01434253c8d30b6cf7c89a9720cd33e653cb4 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Wed, 2 Aug 2023 17:14:14 +0200
Subject: [PATCH] visualc: fix sdl3-config.cmake

---
 VisualC/pkg-support/cmake/sdl3-config.cmake | 30 ++++++++++++---------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/VisualC/pkg-support/cmake/sdl3-config.cmake b/VisualC/pkg-support/cmake/sdl3-config.cmake
index 4a9b4ac2a7c56..fda40b7de39ec 100644
--- a/VisualC/pkg-support/cmake/sdl3-config.cmake
+++ b/VisualC/pkg-support/cmake/sdl3-config.cmake
@@ -1,7 +1,7 @@
 # SDL CMake configuration file:
 # This file is meant to be placed in a cmake subfolder of SDL3-devel-3.x.y-VC
 
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.0...3.5)
 
 include(FeatureSummary)
 set_package_properties(SDL3 PROPERTIES
@@ -39,20 +39,23 @@ else()
     return()
 endif()
 
-set_and_check(_sdl3_prefix      "${CMAKE_CURRENT_LIST_DIR}/..")
-set(_sdl3_include_dirs          "${_sdl3_prefix}/include")
-unset(_sdl3_prefix)
+get_filename_component(_sdl3_prefix "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
+set_and_check(_sdl3_prefix      "${_sdl3_prefix}")
+set(_sdl3_include_dirs          "${_sdl3_prefix}/include;${_sdl3_prefix}/include/SDL3")
 
-set(SDL3_LIBRARIES      SDL3::SDL3)
-set(SDL3TEST_LIBRARY    SDL3::SDL3_test)
+set(_sdl3_library     "${_sdl3_prefix}/lib/${_sdl_arch_subdir}/SDL3.lib")
+set(_sdl3_dll_library "${_sdl3_prefix}/lib/${_sdl_arch_subdir}/SDL3.dll")
+set(_sdl3test_library "${_sdl3_prefix}/lib/${_sdl_arch_subdir}/SDL3_test.lib")
 
+unset(_sdl_arch_subdir)
+unset(_sdl3_prefix)
 
 # All targets are created, even when some might not be requested though COMPONENTS.
 # This is done for compatibility with CMake generated SDL3-target.cmake files.
 
 if(NOT TARGET SDL3::Headers)
     add_library(SDL3::Headers INTERFACE IMPORTED)
-    set_target_properties(SDL3::SDL3
+    set_target_properties(SDL3::Headers
         PROPERTIES
             INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_include_dirs}"
     )
@@ -60,8 +63,6 @@ endif()
 set(SDL3_Headers_FOUND TRUE)
 unset(_sdl3_include_dirs)
 
-set(_sdl3_library     "${SDL3_LIBDIR}/SDL3.lib")
-set(_sdl3_dll_library "${SDL3_BINDIR}/SDL3.dll")
 if(EXISTS "${_sdl3_library}" AND EXISTS "${_sdl3_dll_library}")
     if(NOT TARGET SDL3::SDL3-shared)
         add_library(SDL3::SDL3-shared SHARED IMPORTED)
@@ -85,7 +86,6 @@ unset(_sdl3_dll_library)
 
 set(SDL3_SDL3-static_FOUND FALSE)
 
-set(_sdl3test_library "${SDL3_LIBDIR}/SDL3_test.lib")
 if(EXISTS "${_sdl3test_library}")
     if(NOT TARGET SDL3::SDL3_test)
         add_library(SDL3::SDL3_test STATIC IMPORTED)
@@ -103,7 +103,7 @@ else()
 endif()
 unset(_sdl3test_library)
 
-if(SDL3_SDL3-shared_FOUND OR SDL3_SDL3-static_FOUND)
+if(SDL3_SDL3-shared_FOUND)
     set(SDL3_SDL3_FOUND TRUE)
 endif()
 
@@ -121,9 +121,13 @@ endfunction()
 if(NOT TARGET SDL3::SDL3)
     if(TARGET SDL3::SDL3-shared)
         _sdl_create_target_alias_compat(SDL3::SDL3 SDL3::SDL3-shared)
-    else()
-        _sdl_create_target_alias_compat(SDL3::SDL3 SDL3::SDL3-static)
     endif()
 endif()
 
 check_required_components(SDL3)
+
+set(SDL3_LIBRARIES SDL3::SDL3)
+set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static)
+set(SDL3_STATIC_PRIVATE_LIBS)
+
+set(SDL3TEST_LIBRARY SDL3::SDL3_test)