From 869b5c8918674d6069652b2b688e4faf59c87ffe Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Tue, 17 Apr 2018 06:46:22 +0000 Subject: [PATCH] Explicitly link against -lpthread on Unix /usr/bin/ld.lld: error: undefined symbol: pthread_condattr_init >>> referenced by src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp >>> src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o:(boost::condition_variable::condition_variable()) /usr/bin/ld.lld: error: undefined symbol: pthread_condattr_setclock >>> referenced by src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp >>> src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o:(boost::condition_variable::condition_variable()) /usr/bin/ld.lld: error: undefined symbol: pthread_condattr_destroy >>> referenced by src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp >>> src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o:(boost::condition_variable::condition_variable()) --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git CMakeLists.txt CMakeLists.txt index cc06f908642..7230ae70de8 100644 --- CMakeLists.txt +++ CMakeLists.txt @@ -596,6 +596,11 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS filesystem program_options regex signals system thread REQUIRED) + if(UNIX AND NOT APPLE) + # Boost.Thread 1.67+ headers reference pthread_condattr_* + list(APPEND Boost_LIBRARIES pthread) + endif() + IF(NOT Boost_FOUND) MESSAGE(FATAL_ERROR "========================================\n" "boost not found, install the components:\n"