Commit cbb1cf0c930602c4e0001fc1768f070334141fd9

Anonymous Maarten 2022-10-04T21:15:09

cmake+xcode: only create SDL2::SDL2main target when it does not exist again

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake
index ca6bb3e..e4294d9 100644
--- a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake
+++ b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake
@@ -58,10 +58,12 @@ if(NOT TARGET SDL2::SDL2)
             COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED"
             INTERFACE_SDL2_SHARED "ON"
     )
-    set(SDL2_SDL2_FOUND TRUE)
 endif()
+set(SDL2_SDL2_FOUND TRUE)
 
-add_library(SDL2::SDL2main INTERFACE IMPORTED)
+if(NOT TARGET SDL2::SDL2main)
+    add_library(SDL2::SDL2main INTERFACE IMPORTED)
+endif()
 set(SDL2_SDL2main_FOUND TRUE)
 
 check_required_components(SDL2)