]> git.pld-linux.org Git - packages/SDL2.git/blame - cmake-target.patch
upstream fix for missing cmake target; rel 2
[packages/SDL2.git] / cmake-target.patch
CommitLineData
56c60aaa
JP
1From 945b611b268032bc11ef27812b2ce197f639e1e2 Mon Sep 17 00:00:00 2001
2From: Anonymous Maarten <anonymous.maarten@gmail.com>
3Date: Wed, 24 Aug 2022 04:12:58 +0200
4Subject: [PATCH 1/2] cmake: create SDL2::SDL2main target in Apple framework
5 official release
6
7---
8 Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake | 5 ++++-
9 1 file changed, 4 insertions(+), 1 deletion(-)
10
11diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake
12index cc5cc4a8a57..ca6bb3e9230 100644
13--- a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake
14+++ b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake
15@@ -58,7 +58,10 @@ if(NOT TARGET SDL2::SDL2)
16 COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED"
17 INTERFACE_SDL2_SHARED "ON"
18 )
19+ set(SDL2_SDL2_FOUND TRUE)
20 endif()
21-set(SDL2_SDL2_FOUND)
22+
23+add_library(SDL2::SDL2main INTERFACE IMPORTED)
24+set(SDL2_SDL2main_FOUND TRUE)
25
26 check_required_components(SDL2)
27
28From d2f4748d9753398c703dc0db10891136ab71621a Mon Sep 17 00:00:00 2001
29From: Anonymous Maarten <anonymous.maarten@gmail.com>
30Date: Wed, 24 Aug 2022 04:14:52 +0200
31Subject: [PATCH 2/2] cmake: always create SDL2::SDL2main target in autotools'
32 cmake config script
33
34---
35 sdl2-config.cmake.in | 57 ++++++++++++++++++++++----------------------
36 1 file changed, 29 insertions(+), 28 deletions(-)
37
38diff --git a/sdl2-config.cmake.in b/sdl2-config.cmake.in
39index 75bd8d1edf0..2457586e6fb 100644
40--- a/sdl2-config.cmake.in
41+++ b/sdl2-config.cmake.in
42@@ -62,38 +62,39 @@ string(REGEX REPLACE ";-L" ";" _sdl2_static_private_libdirs "${_sdl2_static_priv
43 if(_sdl2_libraries MATCHES ".*SDL2main.*")
44 list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main)
45 list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main)
46- set(_sdl2main_library ${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX})
47- if(EXISTS "${_sdl2main_library}")
48- set(SDL2MAIN_LIBRARY SDL2::SDL2main)
49- if(NOT TARGET SDL2::SDL2main)
50- add_library(SDL2::SDL2main STATIC IMPORTED)
51- set_target_properties(SDL2::SDL2main
52- PROPERTIES
53- IMPORTED_LOCATION "${_sdl2main_library}"
54- )
55- if(WIN32)
56- # INTERFACE_LINK_OPTIONS needs CMake 3.13
57- cmake_minimum_required(VERSION 3.13)
58- # Mark WinMain/WinMain@16 as undefined, such that it will be withheld by the linker.
59- if(CMAKE_SIZEOF_VOID_P EQUAL 4)
60- set_target_properties(SDL2::SDL2main
61- PROPERTIES
62- INTERFACE_LINK_OPTIONS "-Wl,--undefined=_WinMain@16"
63- )
64- else()
65- set_target_properties(SDL2::SDL2main
66- PROPERTIES
67- INTERFACE_LINK_OPTIONS "-Wl,--undefined=WinMain"
68- )
69- endif()
70+endif()
71+
72+set(_sdl2main_library ${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX})
73+if(EXISTS "${_sdl2main_library}")
74+ set(SDL2MAIN_LIBRARY SDL2::SDL2main)
75+ if(NOT TARGET SDL2::SDL2main)
76+ add_library(SDL2::SDL2main STATIC IMPORTED)
77+ set_target_properties(SDL2::SDL2main
78+ PROPERTIES
79+ IMPORTED_LOCATION "${_sdl2main_library}"
80+ )
81+ if(WIN32)
82+ # INTERFACE_LINK_OPTIONS needs CMake 3.13
83+ cmake_minimum_required(VERSION 3.13)
84+ # Mark WinMain/WinMain@16 as undefined, such that it will be withheld by the linker.
85+ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
86+ set_target_properties(SDL2::SDL2main
87+ PROPERTIES
88+ INTERFACE_LINK_OPTIONS "-Wl,--undefined=_WinMain@16"
89+ )
90+ else()
91+ set_target_properties(SDL2::SDL2main
92+ PROPERTIES
93+ INTERFACE_LINK_OPTIONS "-Wl,--undefined=WinMain"
94+ )
95 endif()
96 endif()
97- set(SDL2_SDL2main_FOUND TRUE)
98- else()
99- set(SDL2_SDL2main_FOUND FALSE)
100 endif()
101- unset(_sdl2main_library)
102+ set(SDL2_SDL2main_FOUND TRUE)
103+else()
104+ set(SDL2_SDL2main_FOUND FALSE)
105 endif()
106+unset(_sdl2main_library)
107
108 # Remove SDL2 since this is the "central" library
109 # Remove SDL2main since this will be provided by SDL2::SDL2main (if available)
This page took 0.115158 seconds and 4 git commands to generate.