]> git.pld-linux.org Git - packages/SDL2.git/blob - cmake-target.patch
f611318ada5a60776b4a005f42f06f883b395dd7
[packages/SDL2.git] / cmake-target.patch
1 From 945b611b268032bc11ef27812b2ce197f639e1e2 Mon Sep 17 00:00:00 2001
2 From: Anonymous Maarten <anonymous.maarten@gmail.com>
3 Date: Wed, 24 Aug 2022 04:12:58 +0200
4 Subject: [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
11 diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake
12 index 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
28 From d2f4748d9753398c703dc0db10891136ab71621a Mon Sep 17 00:00:00 2001
29 From: Anonymous Maarten <anonymous.maarten@gmail.com>
30 Date: Wed, 24 Aug 2022 04:14:52 +0200
31 Subject: [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
38 diff --git a/sdl2-config.cmake.in b/sdl2-config.cmake.in
39 index 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.05875 seconds and 2 git commands to generate.