-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Prefer -pthread to -lpthread flag in INTERFACE_LINK_LIBS for better compatibility when cross-compiling #771
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
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
Googlers can find more info about SignCLA and this PR by following this link. |
2b81027 to
059cee3
Compare
|
CLAs look good, thanks! Googlers can find more info about SignCLA and this PR by following this link. |
|
Thanks! |
|
Is this actually correct/sufficient though? And yet benchmark uses Line 30 in 505be96
|
|
@LebedevRI if you use |
|
I haven't tested this extensively on other platforms so would be interested to get feedback from experts who understand the nuances more deeply |
|
(Background: @wesm I am commenting here following up you last tweet.)
The key here is to update cmake/Config.cmake.in so that it has: Doing so would ensure that consumer do not have to worry about the private dependencies of the benchmark project and would allow to use Note that CMakeLists.txt would have to be updated to also set |
|
Seems reasonable. @jcfr are you able to submit a PR for this? |
Linking with
-lpthreadinstead of-pthreadcan cause failures of the sort likewhen using libraries cross-compiled on one host for use on another. CMake version 3.1 and higher has the
THREADS_PREFER_PTHREAD_FLAGflag which toggles the behavior of${CMAKE_THREAD_LIBS_INIT}.See https://cmake.org/cmake/help/v3.1/module/FindThreads.html