Browse Source

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

Anonymous Maarten 2 years ago
parent
commit
cbb1cf0c93
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake

+ 4 - 2
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)