From: Simon McVittie Date: Mon, 12 Mar 2012 15:40:30 +0000 (+0000) Subject: On Unix, link libdbus to a platform-specific threading library X-Git-Tag: dbus-1.6.2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b47f4c22ee7adf57e1a5377d5f9cbdbe6423a111;p=thirdparty%2Fdbus.git On Unix, link libdbus to a platform-specific threading library On Linux, this is libpthread; on other Unixes, in principle it might be called libpthreads or libthreads or something. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=47237 Signed-off-by: Simon McVittie Reviewed-by: Ralf Habacker --- diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ba44d575d..000acda2d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -83,6 +83,8 @@ option (DBUS_USE_EXPAT "Use expat (== ON) or libxml2 (==OFF)" ON) if(NOT WIN32) option (DBUS_ENABLE_ABSTRACT_SOCKETS "enable support for abstract sockets" ON) + set (CMAKE_THREAD_PREFER_PTHREAD ON) + include (FindThreads) endif(NOT WIN32) #AC_ARG_ENABLE(asserts, AS_HELP_STRING([--enable-asserts],[include assertion checks]),enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE) diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt index 13d6f87a7..d09e63df3 100644 --- a/cmake/dbus/CMakeLists.txt +++ b/cmake/dbus/CMakeLists.txt @@ -266,6 +266,8 @@ if(WIN32) else(WINCE) target_link_libraries(dbus-1 ws2_32 advapi32 netapi32) endif(WINCE) +else(WIN32) + target_link_libraries(dbus-1 ${CMAKE_THREAD_LIBS_INIT}) endif(WIN32) install_targets(/lib dbus-1 ) @@ -289,6 +291,8 @@ if(WIN32) else(WINCE) target_link_libraries(dbus-internal ws2_32 advapi32 netapi32) endif(WINCE) +else(WIN32) + target_link_libraries(dbus-internal ${CMAKE_THREAD_LIBS_INIT}) endif(WIN32) if (DBUS_BUILD_TESTS)