|
3 | 3 | # or in the CMake directory of a SDL3 framework for iOS / tvOS / visionOS. |
4 | 4 |
|
5 | 5 | # INTERFACE_LINK_OPTIONS needs CMake 3.12 |
6 | | -cmake_minimum_required(VERSION 3.12) |
| 6 | +cmake_minimum_required(VERSION 3.12...4.0) |
7 | 7 |
|
8 | 8 | include(FeatureSummary) |
9 | 9 | set_package_properties(SDL3 PROPERTIES |
@@ -32,26 +32,28 @@ endmacro() |
32 | 32 |
|
33 | 33 | set(SDL3_FOUND TRUE) |
34 | 34 |
|
35 | | -# Compute the installation prefix relative to this file. |
36 | | -set(_sdl3_framework_path "${CMAKE_CURRENT_LIST_DIR}") |
37 | | -get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) |
| 35 | +# Compute the installation prefix relative to this file: |
| 36 | +# search upwards for the .framework directory |
| 37 | +set(_current_path "${CMAKE_CURRENT_LIST_DIR}") |
| 38 | +get_filename_component(_current_path "${_current_path}" REALPATH) |
| 39 | +set(_sdl3_framework_path "") |
38 | 40 |
|
39 | | -# Search upwards for the .framework directory |
40 | 41 | set(_current_path "${_sdl3_framework_path}") |
41 | | -set(_found_framework FALSE) |
42 | | -foreach(i RANGE 10) # max 10 levels up |
43 | | - if (IS_DIRECTORY "${_current_path}" AND "${_current_path}" MATCHES "\\.framework$") |
| 42 | +while(NOT _sdl3_framework_path) |
| 43 | + if (IS_DIRECTORY "${_current_path}" AND "${_current_path}" MATCHES "/SDL3\\.framework$") |
44 | 44 | set(_sdl3_framework_path "${_current_path}") |
45 | | - set(_found_framework TRUE) |
46 | 45 | break() |
47 | 46 | endif() |
48 | | - if ("${_current_path}" STREQUAL "") |
| 47 | + get_filename_component(_next_current_path "${_current_path}" DIRECTORY) |
| 48 | + if ("${_current_path}" STREQUAL "${_next_current_path}") |
49 | 49 | break() |
50 | 50 | endif() |
51 | | - get_filename_component(_current_path "${_current_path}" DIRECTORY) |
| 51 | + set(_next_current_path "${_current_path}") |
52 | 52 | endforeach() |
| 53 | +set(_next_current_path) |
| 54 | +set(_next_current_path) |
53 | 55 |
|
54 | | -if(NOT _found_framework) |
| 56 | +if(NOT _sdl3_framework_path) |
55 | 57 | message(FATAL_ERROR "Could not find SDL3.framework root from ${CMAKE_CURRENT_LIST_DIR}") |
56 | 58 | endif() |
57 | 59 |
|
|
0 commit comments