From 20296b5636443b71561ee8144227f010a802017d 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 a/CMakeLists.txt b/CMakeLists.txt index cc06f90864..7230ae70de 100644 --- a/CMakeLists.txt +++ b/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"