vcpkg/ports/sdl2/0004-sdl2-alias-on-static-build.patch
Rémy Tassoux 25382e39f7
[sdl2] Update to 2.0.16 (#19509)
* [sdl2] Update to 2.0.16

* [sdl2] Update version files

* [sdl2] Fix uwp builds

* [sdl2] Update version files

* [sdl2] Change version-semver to version

* [sdl2] Fix uwp pkgconfig file creation

* [sdl2] Add alias on static build

* [sdl2] Remove cmake wrapper

* [sdl2] Update version files

* [sdl2] Disable SDL2::SDL2main target search on uwp

* [sdl2] Update version files

Co-authored-by: Rémy Tassoux <rt2@rasterizedworld.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2021-08-18 17:19:15 -07:00

18 lines
682 B
Diff

--- a/SDL2Config.cmake
+++ b/SDL2Config.cmake
@@ -2,5 +2,14 @@
include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake")
+# on static-only builds create an alias
+if(NOT TARGET SDL2::SDL2 AND TARGET SDL2::SDL2-static)
+ 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)
+ 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