From 90007a6cb72da346adeb813c5c03c20493e2c817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 26 Oct 2019 18:47:34 +0200 Subject: [PATCH] modules: clean up pthread linking in FindSDL2.cmake. Should not have any functional change, however we can now use the imported target (instead of a variable that can be empty if threads are not found), using REQUIRED because otherwise it makes no sense, and checking explicitly for both libraries instead of the merged variable (because there it's only an accident it actually works). --- modules/FindSDL2.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/FindSDL2.cmake b/modules/FindSDL2.cmake index 4086a0025..50ab04529 100644 --- a/modules/FindSDL2.cmake +++ b/modules/FindSDL2.cmake @@ -167,10 +167,10 @@ if(NOT TARGET SDL2::SDL2) # 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) + if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE AND (SDL2_LIBRARY_DEBUG MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$" OR SDL2_LIBRARY_RELEASE MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$")) + find_package(Threads REQUIRED) set_property(TARGET SDL2::SDL2 APPEND PROPERTY - INTERFACE_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) + INTERFACE_LINK_LIBRARIES Threads::Threads ${CMAKE_DL_LIBS}) endif() # Link frameworks on iOS