[cmake-developers] [CMake 0014049]: FindThreads.cmake: several small bugs

Mantis Bug Tracker mantis at public.kitware.com
Fri Mar 29 12:37:46 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14049 
====================================================================== 
Reported By:                Nico
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14049
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-03-29 12:37 EDT
Last Modified:              2013-03-29 12:37 EDT
====================================================================== 
Summary:                    FindThreads.cmake: several small bugs
Description: 
I just browsed through FindThreads.cmake and found that it probably needs to be
looked through more carefully.
Two things that I noticed:

* The variable THREADS_HAVE_PTHREAD_ARG is referenced before it is first
assigned, meaning that the test if(THREADS_HAVE_PTHREAD_ARG) is unconditionally
false.
* When going through the library search (-lpthreads, -lpthread, -lthread), each
of those blocks should probably be encapsulated in

  if(NOT CMAKE_HAVE_THREADS_LIBRARY)
  [...]
  endif()
 
  Otherwise the keeps testing even though a library has already been found.

The question remains what the priorities should be if -lpthreads is present,
-pthread is a valid compiler flag, and threads are already built into the
standard library.

I'm thinking 3-2-1 would be a reasonable choice, in which case the order of the
checking would have to be slightly adapted.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-03-29 12:37 Nico           New Issue                                    
======================================================================




More information about the cmake-developers mailing list