@@ -223,7 +223,7 @@ function(PCL_ADD_LIBRARY _name)
223223 PCL_ADD_VERSION_INFO(${_name} )
224224 target_compile_features (${_name} PUBLIC ${PCL_CXX_COMPILE_FEATURES} )
225225 # must link explicitly against boost.
226- target_link_libraries (${_name} ${Boost_LIBRARIES} )
226+ target_link_libraries (${_name} ${Boost_LIBRARIES} Threads::Threads )
227227 if ((UNIX AND NOT ANDROID) OR MINGW)
228228 target_link_libraries (${_name} m)
229229 endif ()
@@ -302,11 +302,7 @@ function(PCL_ADD_EXECUTABLE _name)
302302 endif ()
303303 PCL_ADD_VERSION_INFO(${_name} )
304304 # must link explicitly against boost.
305- if (UNIX AND NOT ANDROID)
306- target_link_libraries (${_name} ${Boost_LIBRARIES} pthread m ${CLANG_LIBRARIES} )
307- else ()
308- target_link_libraries (${_name} ${Boost_LIBRARIES} )
309- endif ()
305+ target_link_libraries (${_name} ${Boost_LIBRARIES} Threads::Threads)
310306
311307 if (WIN32 AND MSVC )
312308 set_target_properties (${_name} PROPERTIES DEBUG_OUTPUT_NAME ${_name}${CMAKE_DEBUG_POSTFIX}
@@ -384,12 +380,7 @@ macro(PCL_ADD_TEST _name _exename)
384380 #target_link_libraries(${_exename} ${GTEST_BOTH_LIBRARIES} ${PCL_ADD_TEST_LINK_WITH})
385381 target_link_libraries (${_exename} ${PCL_ADD_TEST_LINK_WITH} ${CLANG_LIBRARIES} )
386382
387- if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
388- target_link_libraries (${_exename} pthread)
389- elseif (UNIX AND NOT ANDROID)
390- # GTest >= 1.5 requires pthread and CMake's 2.8.4 FindGTest is broken
391- target_link_libraries (${_exename} pthread)
392- endif ()
383+ target_link_libraries (${_exename} Threads::Threads)
393384
394385 # must link explicitly against boost only on Windows
395386 target_link_libraries (${_exename} ${Boost_LIBRARIES} )
0 commit comments