From: Uwe Hermann Date: Thu, 18 Sep 2014 15:14:14 +0000 (+0200) Subject: Fix the C++11 thread linking issues for unit tests as well. X-Git-Tag: pulseview-0.3.0~535 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=858ae630aec11f2f1300897cc3ca127a4537e598 Fix the C++11 thread linking issues for unit tests as well. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 27859b3a..f334f911 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,8 @@ endif() find_package(Boost 1.42 COMPONENTS filesystem system REQUIRED) +# Find the platform's thread library (needed for C++11 threads). +# This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value. find_package(Threads REQUIRED) #=============================================================================== diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6886f94a..9d839cb0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -31,6 +31,10 @@ pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS}) find_package(Boost 1.42 COMPONENTS filesystem system unit_test_framework REQUIRED) +# Find the platform's thread library (needed for C++11 threads). +# This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value. +find_package(Threads REQUIRED) + find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac) find_package(Qt4 REQUIRED) @@ -136,7 +140,7 @@ endif() # On MinGW we need to use static linking. if(NOT WIN32) -add_definitions(-DBOOST_TEST_DYN_LINK) + add_definitions(-DBOOST_TEST_DYN_LINK) endif() add_definitions(${QT_DEFINITIONS}) @@ -150,6 +154,7 @@ set(PULSEVIEW_LINK_LIBS ${Boost_LIBRARIES} ${PKGDEPS_LIBRARIES} ${QT_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ) if(WIN32)