|
@@ -30,12 +30,14 @@ endif()
|
|
|
check_required_components(SDL2)
|
|
|
|
|
|
# Create SDL2::SDL2 alias for static-only builds
|
|
|
-if(NOT TARGET SDL2::SDL2 AND TARGET SDL2::SDL2-static)
|
|
|
+if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2)
|
|
|
if(CMAKE_VERSION VERSION_LESS "3.18")
|
|
|
- # Aliasing local targets is not supported on CMake < 3.18, so make it global.
|
|
|
- set_target_properties(SDL2::SDL2-static PROPERTIES IMPORTED_GLOBAL TRUE)
|
|
|
+ # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global.
|
|
|
+ add_library(SDL2::SDL2 INTERFACE IMPORTED)
|
|
|
+ set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2::SDL2-static")
|
|
|
+ else()
|
|
|
+ add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static)
|
|
|
endif()
|
|
|
- add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static)
|
|
|
endif()
|
|
|
|
|
|
# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables.
|
|
@@ -57,4 +59,4 @@ if(TARGET SDL2::SDL2main)
|
|
|
list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main)
|
|
|
endif()
|
|
|
|
|
|
-set(SDL2TEST_LIBRARY SDL2::SDL2test)
|
|
|
+set(SDL2TEST_LIBRARY SDL2::SDL2test)
|