From 3933e8a901740de80133f15daf3d114867c08e0c Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Tue, 15 Jan 2013 16:09:57 -0600 Subject: [PATCH] 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 --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4448260..ebe156d 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} ) -- 2.30.2