2021-08-19 08:19:15 +08:00
|
|
|
--- a/SDL2Config.cmake
|
|
|
|
+++ b/SDL2Config.cmake
|
2021-10-07 02:12:42 +08:00
|
|
|
@@ -1,5 +1,17 @@
|
2021-08-19 08:19:15 +08:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake")
|
|
|
|
|
|
|
|
+# on static-only builds create an alias
|
|
|
|
+if(NOT TARGET SDL2::SDL2 AND TARGET SDL2::SDL2-static)
|
2021-10-07 02:12:42 +08:00
|
|
|
+ if(CMAKE_VERSION VERSION_LESS "3.11")
|
|
|
|
+ message(FATAL_ERROR "At least CMake 3.11 is required for this configuration.")
|
|
|
|
+ elseif(CMAKE_VERSION VERSION_LESS "3.18")
|
|
|
|
+ # Aliasing local targets is not supported on CMake < 3.18, so make all targets global.
|
2021-08-19 08:19:15 +08:00
|
|
|
+ set_target_properties(SDL2::SDL2-static PROPERTIES IMPORTED_GLOBAL TRUE)
|
2021-10-07 02:12:42 +08:00
|
|
|
+ set_target_properties(SDL2::SDL2main PROPERTIES IMPORTED_GLOBAL TRUE)
|
2021-08-19 08:19:15 +08:00
|
|
|
+ endif()
|
|
|
|
+ add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static)
|
|
|
|
+endif()
|
|
|
|
+
|
|
|
|
# provide ${SDL2_LIBRARIES}, ${SDL2_INCLUDE_DIRS} etc, like sdl2-config.cmake does,
|
|
|
|
# for compatibility between SDL2 built with autotools and SDL2 built with CMake
|
|
|
|
|