Fix the C++11 thread linking issues for unit tests as well.
authorUwe Hermann <uwe@hermann-uwe.de>
Thu, 18 Sep 2014 15:14:14 +0000 (17:14 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Thu, 18 Sep 2014 15:14:14 +0000 (17:14 +0200)
CMakeLists.txt
test/CMakeLists.txt

index 27859b3ad0674bcf48dbe16203229391dad0b82e..f334f9118c024018179cd8fb433d2525790cce39 100644 (file)
@@ -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)
 
 #===============================================================================
index 6886f94a07cae3fb341c8a362e59e75cd7209525..9d839cb0970b7d39239df107eaf4f7e01e127fbb 100644 (file)
@@ -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)