[cmake-developers] [CMake 0014767]: FindThreads.cmake prefers -lpthread over -pthread with GCC

Mantis Bug Tracker mantis at public.kitware.com
Thu Feb 20 13:32:12 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14767 
====================================================================== 
Reported By:                zub
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14767
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-02-20 13:32 EST
Last Modified:              2014-02-20 13:32 EST
====================================================================== 
Summary:                    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
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-02-20 13:32 zub            New Issue                                    
======================================================================



More information about the cmake-developers mailing list