-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add thread library of the system by Threads::Threads
instead of via -pthread
flag
#3102
Add thread library of the system by Threads::Threads
instead of via -pthread
flag
#3102
Conversation
CMakeLists.txt
Outdated
@@ -90,6 +90,7 @@ else() | |||
set(CMAKE_CXX_FLAGS_DEFAULT "") | |||
endif() | |||
|
|||
find_package(Threads REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our dependency finding is usually performed at the the bottom of this file. Did you had the add it here to be able to reference Threads::Threads
inside the functions in pcl_targets.cmake
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to call find_package
before any call to PCL_ADD_EXAMPLE
, PCL_ADD_LIBRARY
, ... but yeah, I could move to the other dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated code to fix it. There is only one question open: what do you think about THREADS_PREFER_PTHREAD_FLAG
option? Should be set it or not?
Btw: find_package
is required, because Unix requires threading library and on Windows Threads::Threads
will be always an empty target, so MSVC doesn't complain that there is no threading library on Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated code to fix it. There is only one question open: what do you think about
THREADS_PREFER_PTHREAD_FLAG
option? Should be set it or not?
Sorry. Totally overlooked this question. I have no reason to be opinionated here so I would not set anything.
Come to think about it, I'm not sure it is a good idea to add |
It's a quick and dirty fix, so everything is compiling again. The |
…ead flag. This commit also fix "//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line". This issue was caused by missing linking of thread library in PCL_ADD_LIBRARY.
bd8c6d1
to
73bf70d
Compare
Threads::Threads
instead of via -pthread
flag
This fixes my current linker error I get since #3094
This issue was caused by missing linking of thread library in PCL_ADD_LIBRARY.
As we always add
Threads::Threads
(except for PCL-CUDA-CMake-Scripts), we don't addpthread
anymore toCMAKE_CXX_FLAGS
.