diff options
Diffstat (limited to 'contrib/SDL-3.2.8/build-scripts/pkg-support/msvc/cmake/SDL3Config.cmake.in')
| -rw-r--r-- | contrib/SDL-3.2.8/build-scripts/pkg-support/msvc/cmake/SDL3Config.cmake.in | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/build-scripts/pkg-support/msvc/cmake/SDL3Config.cmake.in b/contrib/SDL-3.2.8/build-scripts/pkg-support/msvc/cmake/SDL3Config.cmake.in new file mode 100644 index 0000000..6387376 --- /dev/null +++ b/contrib/SDL-3.2.8/build-scripts/pkg-support/msvc/cmake/SDL3Config.cmake.in | |||
| @@ -0,0 +1,135 @@ | |||
| 1 | # @<@PROJECT_NAME@>@ CMake configuration file: | ||
| 2 | # This file is meant to be placed in a cmake subfolder of @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip | ||
| 3 | |||
| 4 | cmake_minimum_required(VERSION 3.0...3.28) | ||
| 5 | |||
| 6 | include(FeatureSummary) | ||
| 7 | set_package_properties(SDL3 PROPERTIES | ||
| 8 | URL "https://www.libsdl.org/" | ||
| 9 | DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" | ||
| 10 | ) | ||
| 11 | |||
| 12 | # Copied from `configure_package_config_file` | ||
| 13 | macro(set_and_check _var _file) | ||
| 14 | set(${_var} "${_file}") | ||
| 15 | if(NOT EXISTS "${_file}") | ||
| 16 | message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") | ||
| 17 | endif() | ||
| 18 | endmacro() | ||
| 19 | |||
| 20 | # Copied from `configure_package_config_file` | ||
| 21 | macro(check_required_components _NAME) | ||
| 22 | foreach(comp ${${_NAME}_FIND_COMPONENTS}) | ||
| 23 | if(NOT ${_NAME}_${comp}_FOUND) | ||
| 24 | if(${_NAME}_FIND_REQUIRED_${comp}) | ||
| 25 | set(${_NAME}_FOUND FALSE) | ||
| 26 | endif() | ||
| 27 | endif() | ||
| 28 | endforeach() | ||
| 29 | endmacro() | ||
| 30 | |||
| 31 | set(SDL3_FOUND TRUE) | ||
| 32 | |||
| 33 | if(SDL_CPU_X86) | ||
| 34 | set(_sdl_arch_subdir "x86") | ||
| 35 | elseif(SDL_CPU_X64 OR SDL_CPU_ARM64EC) | ||
| 36 | set(_sdl_arch_subdir "x64") | ||
| 37 | elseif(SDL_CPU_ARM64) | ||
| 38 | set(_sdl_arch_subdir "arm64") | ||
| 39 | else() | ||
| 40 | set(SDL3_FOUND FALSE) | ||
| 41 | return() | ||
| 42 | endif() | ||
| 43 | |||
| 44 | get_filename_component(_sdl3_prefix "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) | ||
| 45 | set_and_check(_sdl3_prefix "${_sdl3_prefix}") | ||
| 46 | set(_sdl3_include_dirs "${_sdl3_prefix}/include") | ||
| 47 | |||
| 48 | set(_sdl3_implib "${_sdl3_prefix}/lib/${_sdl_arch_subdir}/SDL3.lib") | ||
| 49 | set(_sdl3_dll "${_sdl3_prefix}/lib/${_sdl_arch_subdir}/SDL3.dll") | ||
| 50 | set(_sdl3test_lib "${_sdl3_prefix}/lib/${_sdl_arch_subdir}/SDL3_test.lib") | ||
| 51 | |||
| 52 | unset(_sdl_arch_subdir) | ||
| 53 | unset(_sdl3_prefix) | ||
| 54 | |||
| 55 | # All targets are created, even when some might not be requested though COMPONENTS. | ||
| 56 | # This is done for compatibility with CMake generated SDL3-target.cmake files. | ||
| 57 | |||
| 58 | if(NOT TARGET SDL3::Headers) | ||
| 59 | add_library(SDL3::Headers INTERFACE IMPORTED) | ||
| 60 | set_target_properties(SDL3::Headers | ||
| 61 | PROPERTIES | ||
| 62 | INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_include_dirs}" | ||
| 63 | ) | ||
| 64 | endif() | ||
| 65 | set(SDL3_Headers_FOUND TRUE) | ||
| 66 | unset(_sdl3_include_dirs) | ||
| 67 | |||
| 68 | if(EXISTS "${_sdl3_implib}" AND EXISTS "${_sdl3_dll}") | ||
| 69 | if(NOT TARGET SDL3::SDL3-shared) | ||
| 70 | add_library(SDL3::SDL3-shared SHARED IMPORTED) | ||
| 71 | set_target_properties(SDL3::SDL3-shared | ||
| 72 | PROPERTIES | ||
| 73 | INTERFACE_LINK_LIBRARIES "SDL3::Headers" | ||
| 74 | IMPORTED_IMPLIB "${_sdl3_implib}" | ||
| 75 | IMPORTED_LOCATION "${_sdl3_dll}" | ||
| 76 | COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" | ||
| 77 | INTERFACE_SDL3_SHARED "ON" | ||
| 78 | COMPATIBLE_INTERFACE_STRING "SDL_VERSION" | ||
| 79 | INTERFACE_SDL_VERSION "SDL3" | ||
| 80 | ) | ||
| 81 | endif() | ||
| 82 | set(SDL3_SDL3-shared_FOUND TRUE) | ||
| 83 | else() | ||
| 84 | set(SDL3_SDL3-shared_FOUND FALSE) | ||
| 85 | endif() | ||
| 86 | unset(_sdl3_implib) | ||
| 87 | unset(_sdl3_dll) | ||
| 88 | |||
| 89 | set(SDL3_SDL3-static_FOUND FALSE) | ||
| 90 | |||
| 91 | if(EXISTS "${_sdl3test_lib}") | ||
| 92 | if(NOT TARGET SDL3::SDL3_test) | ||
| 93 | add_library(SDL3::SDL3_test STATIC IMPORTED) | ||
| 94 | set_target_properties(SDL3::SDL3_test | ||
| 95 | PROPERTIES | ||
| 96 | INTERFACE_LINK_LIBRARIES "SDL3::Headers" | ||
| 97 | IMPORTED_LOCATION "${_sdl3test_lib}" | ||
| 98 | COMPATIBLE_INTERFACE_STRING "SDL_VERSION" | ||
| 99 | INTERFACE_SDL_VERSION "SDL3" | ||
| 100 | ) | ||
| 101 | endif() | ||
| 102 | set(SDL3_SDL3_test_FOUND TRUE) | ||
| 103 | else() | ||
| 104 | set(SDL3_SDL3_test_FOUND FALSE) | ||
| 105 | endif() | ||
| 106 | unset(_sdl3test_lib) | ||
| 107 | |||
| 108 | if(SDL3_SDL3-shared_FOUND OR SDL3_SDL3-static_FOUND) | ||
| 109 | set(SDL3_SDL3_FOUND TRUE) | ||
| 110 | endif() | ||
| 111 | |||
| 112 | function(_sdl_create_target_alias_compat NEW_TARGET TARGET) | ||
| 113 | if(CMAKE_VERSION VERSION_LESS "3.18") | ||
| 114 | # Aliasing local targets is not supported on CMake < 3.18, so make it global. | ||
| 115 | add_library(${NEW_TARGET} INTERFACE IMPORTED) | ||
| 116 | set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}") | ||
| 117 | else() | ||
| 118 | add_library(${NEW_TARGET} ALIAS ${TARGET}) | ||
| 119 | endif() | ||
| 120 | endfunction() | ||
| 121 | |||
| 122 | # Make sure SDL3::SDL3 always exists | ||
| 123 | if(NOT TARGET SDL3::SDL3) | ||
| 124 | if(TARGET SDL3::SDL3-shared) | ||
| 125 | _sdl_create_target_alias_compat(SDL3::SDL3 SDL3::SDL3-shared) | ||
| 126 | endif() | ||
| 127 | endif() | ||
| 128 | |||
| 129 | check_required_components(SDL3) | ||
| 130 | |||
| 131 | set(SDL3_LIBRARIES SDL3::SDL3) | ||
| 132 | set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static) | ||
| 133 | set(SDL3_STATIC_PRIVATE_LIBS) | ||
| 134 | |||
| 135 | set(SDL3TEST_LIBRARY SDL3::SDL3_test) | ||
