From 8fb6bfa8dc0e49964155907015f64f904e52695d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 29 May 2018 18:54:03 +0200 Subject: [PATCH] modules: static build of SDL2 on Linux requires pthread and dl. Do the same also for other Unix-like systems except for Apple platforms, where those dependencies are most probably satisfied by some frameworks instead. --- modules/FindSDL2.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/FindSDL2.cmake b/modules/FindSDL2.cmake index c2395b027..bd7ebe765 100644 --- a/modules/FindSDL2.cmake +++ b/modules/FindSDL2.cmake @@ -126,6 +126,15 @@ if(NOT TARGET SDL2::SDL2) set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION ${SDL2_LIBRARY}) endif() + # Link additional `dl` and `pthread` libraries required by a static + # build of SDL on Unixy platforms (except Apple, where it is most + # probably some frameworks instead) + if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE AND SDL2_LIBRARY MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$") + find_package(Threads) + set_property(TARGET SDL2::SDL2 APPEND PROPERTY + INTERFACE_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) + endif() + # Link frameworks on iOS if(CORRADE_TARGET_IOS) set_property(TARGET SDL2::SDL2 APPEND PROPERTY