Browse Source

Fix macOS build with the SDL2 2.24.0

SDL2 2.24.0 has a bug in its cmake for macOS: https://github.com/libsdl-org/SDL/issues/6119

This bug has already been fixed upstream. This is a workaround until the
next version of SDL2 is released.
pull/5283/head
Gleb Mazovetskiy 4 years ago
parent
commit
ac88a38377
  1. 12
      CMake/Dependencies.cmake

12
CMake/Dependencies.cmake

@ -31,7 +31,9 @@ else()
if(DEVILUTIONX_SYSTEM_SDL2)
find_package(SDL2 REQUIRED)
if(TARGET SDL2::SDL2)
set(SDL2_MAIN SDL2::SDL2main)
if(TARGET SDL2::SDL2main)
set(SDL2_MAIN SDL2::SDL2main)
endif()
elseif(TARGET SDL2::SDL2-static)
# On some distros, such as vitasdk, only the SDL2::SDL2-static target is available.
# Alias to SDL2::SDL2 because some finder scripts may refer to SDL2::SDL2.
@ -39,7 +41,9 @@ else()
# 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()
set(SDL2_MAIN SDL2::SDL2main)
if(TARGET SDL2::SDL2main)
set(SDL2_MAIN SDL2::SDL2main)
endif()
else()
# Assume an older Debian derivate that comes with an sdl2-config.cmake
# that only defines `SDL2_LIBRARIES` (as -lSDL2) and `SDL2_INCLUDE_DIRS`.
@ -54,7 +58,9 @@ else()
find_package(SDL2 REQUIRED)
else()
add_subdirectory(3rdParty/SDL2)
set(SDL2_MAIN SDL2::SDL2main)
if(TARGET SDL2::SDL2main)
set(SDL2_MAIN SDL2::SDL2main)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/SDL2/CMake")
endif()
endif()

Loading…
Cancel
Save