From: Alexandru Gagniuc Date: Tue, 15 Jan 2013 22:09:57 +0000 (-0600) Subject: buildsystem: Link against the platform's thread library X-Git-Tag: pulseview-0.1.0~141 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=3933e8a901740de80133f15daf3d114867c08e0c buildsystem: Link against the platform's thread library At least on Linux, boost-thread depends on pthread. The linking is not automatic, and users have had issues with this. We need to link against the platform's thread library, as it is needed for boost-thread. CMake takes care of getting the exact settings to be passed to the linker for us with ${CMAKE_THREAD_LIBS_INIT}. This fixes bug #42. Signed-off-by: Alexandru Gagniuc --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4448260b..ebe156d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ ## This file is part of the PulseView project. ## ## Copyright (C) 2012 Joel Holdsworth -## Copyright (C) 2012 Alexandru Gagniuc +## Copyright (C) 2012-2013 Alexandru Gagniuc ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -53,6 +53,10 @@ pkg_check_modules(PKGDEPS REQUIRED find_package(Qt4 REQUIRED) +# Find the platform's thread library (needed for boost-thread). +# This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value. +find_package(Threads) + if(WIN32) # On Windows/MinGW the we need to use 'thread_win32' instead of 'thread'. # The library is named libboost_thread_win32* (not libboost_thread*). @@ -174,6 +178,7 @@ link_directories(${Boost_LIBRARY_DIRS}) set(PULSEVIEW_LINK_LIBS ${Boost_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} )