From d10b7773240589c29a8f02d7778399b46eb7f355 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 12 Mar 2012 15:40:30 +0000 Subject: [PATCH] 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 --- cmake/CMakeLists.txt | 2 ++ cmake/dbus/CMakeLists.txt | 4 ++++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ba44d57..000acda 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 13d6f87..d09e63d 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) -- 1.7.9.1