View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014049CMakeModulespublic2013-03-29 12:372015-04-06 09:07
ReporterNico Schlömer 
Assigned ToRolf Eike Beer 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 3.1Fixed in VersionCMake 3.1 
Summary0014049: FindThreads.cmake: several small bugs
DescriptionI 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.
TagsNo tags attached.
Attached Files

 Relationships
parent of 0014767closedRolf Eike Beer FindThreads.cmake prefers -lpthread over -pthread with GCC 

  Notes
(0035513)
Rolf Eike Beer (developer)
2014-03-25 18:58

The reading of THREADS_HAVE_PTHREAD_ARG is to prevent the check code running again when CMake reruns.

I have pushed a branch "threads-cleanup" to stage, that is not merged to next right now because CMake 3.0 is so close.

The reordering of the -pthread/-lphtreads stuff is still to be done.
(0036540)
Nico Schlömer (reporter)
2014-08-01 14:55

Fixed by commit 858ce31f4cd8d247a6dd7b8ae70ab9a38f71e7a2 [1].

Feel free to close.

[1] https://github.com/Kitware/CMake/commit/858ce31f4cd8d247a6dd7b8ae70ab9a38f71e7a2 [^]
(0038418)
Robert Maynard (manager)
2015-04-06 09:07

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-03-29 12:37 Nico Schlömer New Issue
2013-04-01 10:05 Brad King Assigned To => Rolf Eike Beer
2013-04-01 10:05 Brad King Status new => assigned
2014-03-25 18:58 Rolf Eike Beer Note Added: 0035513
2014-08-01 14:55 Nico Schlömer Note Added: 0036540
2014-10-06 15:46 Rolf Eike Beer Relationship added parent of 0014767
2014-10-06 15:47 Rolf Eike Beer Status assigned => resolved
2014-10-06 15:47 Rolf Eike Beer Resolution open => fixed
2014-10-06 15:47 Rolf Eike Beer Fixed in Version => CMake 3.1
2014-10-06 15:47 Rolf Eike Beer Target Version => CMake 3.1
2015-04-06 09:07 Robert Maynard Note Added: 0038418
2015-04-06 09:07 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team