]> sigrok.org Git - pulseview.git/commitdiff
buildsystem: Link against the platform's thread library
authorAlexandru Gagniuc <redacted>
Tue, 15 Jan 2013 22:09:57 +0000 (16:09 -0600)
committerUwe Hermann <redacted>
Thu, 24 Jan 2013 21:50:43 +0000 (22:50 +0100)
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 <redacted>
CMakeLists.txt

index 4448260b6bafc31737ec30505ee308cb78cf148c..ebe156d56e5dc902480bbeff3794ba4ab7d831e3 100644 (file)
@@ -2,7 +2,7 @@
 ## This file is part of the PulseView project.
 ##
 ## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
 ## This file is part of the PulseView project.
 ##
 ## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
-## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
+## Copyright (C) 2012-2013 Alexandru Gagniuc <mr.nuke.me@gmail.com>
 ##
 ## 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
 ##
 ## 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_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*).
 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}
 
 set(PULSEVIEW_LINK_LIBS
        ${Boost_LIBRARIES}
+       ${CMAKE_THREAD_LIBS_INIT}
        ${QT_LIBRARIES}
 )
 
        ${QT_LIBRARIES}
 )