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())
This commit is contained in:
Jan Beich
2018-04-17 06:46:22 +00:00
committed by wmayer
parent 16ea64c951
commit 20296b5636

View File

@@ -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"