View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014767 | CMake | Modules | public | 2014-02-20 13:32 | 2015-04-06 09:07 | ||||
Reporter | zub | ||||||||
Assigned To | Rolf Eike Beer | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | linux | OS Version | ||||||
Product Version | CMake 2.8.12.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0014767: FindThreads.cmake prefers -lpthread over -pthread with GCC | ||||||||
Description | With gcc on Linux, FindThreads.cmake finds out that "-lpthread" works and sticks to that. Reading gcc man page, I think "-pthread" should be preferred, as it does the right thing: -pthread Adds support for multithreading with the pthreads library. This option sets flags for both the preprocessor and linker. Too bad that the actual gcc doc doesn't say much about -pthread: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16519 [^] | ||||||||
Steps To Reproduce | Build a simple project that includes FindThreads. | ||||||||
Additional Information | The same issue has been brought up before: http://www.cmake.org/pipermail/cmake/2012-December/052963.html [^] | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | ||||||
|
Relationships |
Notes | |
(0035164) Brad King (manager) 2014-02-21 08:26 |
The FindThreads module is one of the oldest modules in CMake and pre-dates the modern conventions for how to report its results. It needs work to populate the typical result variables as pointed out in Marcel's post from Dec 2012 that you linked. Currently the module reports the *libraries* that are needed. Even if the "-pthread" flag were reported as a "library" in CMAKE_THREAD_LIBS_INIT the application would still only use it with target_link_libraries. Then the flag would be used only when linking and not when compiling so the preprocessor definitions would still not appear. AFAIK -pthread and -lpthread are equivalent when the compiler front-end is used only to drive linking and no compilations. If the module were modernized to report modern result variables then one of them could be the compilation flags needed to use threads. Then it could include -pthread. |
(0036986) Rolf Eike Beer (developer) 2014-10-06 15:54 |
Should all be fine now: http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b838deb2e9627bf2d607de300f4a9ca287baec38 [^] These changes are in next now and will hopefully show up either in 3.1 or 3.2. |
(0038419) Robert Maynard (manager) 2015-04-06 09:07 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2014-02-20 13:32 | zub | New Issue | |
2014-02-21 08:26 | Brad King | Note Added: 0035164 | |
2014-10-06 15:46 | Rolf Eike Beer | Relationship added | child of 0014049 |
2014-10-06 15:54 | Rolf Eike Beer | Note Added: 0036986 | |
2014-10-06 15:54 | Rolf Eike Beer | Assigned To | => Rolf Eike Beer |
2014-10-06 15:54 | Rolf Eike Beer | Status | new => resolved |
2014-10-06 15:54 | Rolf Eike Beer | Resolution | open => fixed |
2015-04-06 09:07 | Robert Maynard | Note Added: 0038419 | |
2015-04-06 09:07 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |