Browse Source

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).
pull/388/head
Vladimír Vondruš 7 years ago
parent
commit
90007a6cb7
  1. 6
      modules/FindSDL2.cmake

6
modules/FindSDL2.cmake

@ -167,10 +167,10 @@ if(NOT TARGET SDL2::SDL2)
# Link additional `dl` and `pthread` libraries required by a static # Link additional `dl` and `pthread` libraries required by a static
# build of SDL on Unixy platforms (except Apple, where it is most # build of SDL on Unixy platforms (except Apple, where it is most
# probably some frameworks instead) # probably some frameworks instead)
if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE AND SDL2_LIBRARY MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$") 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) find_package(Threads REQUIRED)
set_property(TARGET SDL2::SDL2 APPEND PROPERTY 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() endif()
# Link frameworks on iOS # Link frameworks on iOS

Loading…
Cancel
Save