Make it build in arch linux and Debian

* Probably unresolved external due to newer gcc, thus
  added libsdl to libui.a as well.
* Make it work for all distros, which either have SDL2::SDL2
  or ${SDL2_LIBRARIES}, provided by sdl2-config or FindSDL2.cmake.

Signed-off-by: Andreas J. Reichel <homebase_ar@web.de>
This commit is contained in:
Andreas J. Reichel
2021-10-17 21:17:57 +02:00
parent bd9b6766b7
commit 6dd744141c
2 changed files with 18 additions and 2 deletions

View File

@@ -81,9 +81,13 @@ if(MINGW)
target_link_libraries(86Box SDL2::SDL2-static)
elseif(WIN32)
target_link_libraries(86Box SDL2::SDL2)
else()
if (TARGET SDL2::SDL2)
target_link_libraries(86Box SDL2::SDL2)
else()
target_link_libraries(86Box ${SDL2_LIBRARIES})
endif()
endif()
find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIRS})

View File

@@ -12,6 +12,18 @@ add_library(plat STATIC ${PLAT_SOURCES} unix_thread.c)
add_library(ui STATIC unix.c unix_sdl.c unix_cdrom.c)
target_compile_definitions(ui PUBLIC _FILE_OFFSET_BITS=64)
target_link_libraries(ui dl)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
if(MINGW)
target_link_libraries(ui SDL2::SDL2-static)
else()
if (TARGET SDL2::SDL2)
target_link_libraries(ui SDL2::SDL2)
else()
target_link_libraries(ui ${SDL2_LIBRARIES})
endif()
endif()
if (ALSA_FOUND)
target_link_libraries(plat ALSA::ALSA)
endif()