View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014905CMakeCMakepublic2014-05-05 13:572016-02-01 09:10
ReporterRobert Maynard 
Assigned ToRolf Eike Beer 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 3.0 
Target VersionCMake 3.4Fixed in VersionCMake 3.4 
Summary0014905: FindThreads doesn't clearly express it requires C language enabled.
DescriptionThe FindThread documentation doesn't express that is uses the try_run command and requires that C support has been enabled, when pthread isn't in a system include ( osx xcode 5+, cross compilation ).

I think the documentation should be extended to state that FindThread requires a project to have enabled the C language. It should also document how to properly setup FindThread for cross compilation.

Ee should also consider falling back to the C++ compiler for the try_run if the C compiler doesn't exist, and we don't have a toolchain.
Steps To Reproducerun the minimal project at:
https://github.com/robertmaynard/Sandbox/tree/master/FindThreadCXX [^]
TagsNo tags attached.
Attached Files

 Relationships
related to 0015723closedRolf Eike Beer Regression: FindCUDA fails for C++ only projects in CMake 3.3.1 due find_package(Threads), while it works well in CMake 3.2.3 

  Notes
(0039403)
Brad King (manager)
2015-09-10 16:45

FindThreads uses several checks that are all C-specific. Some of the checks have CXX versions available. Others do not. All this infrasturcture was originally built before we had a notion of enabling C and CXX separately.

I wonder if instead we should memorize in Modules/{Compiler,Platform}/*.cmake what flags/libraries are needed for threading on each system. We could even consider making threading a first-class CMake target property with flag mapping available on all generators. FindThreads could then just forward the information from the platform modules into its legacy variables.
(0039474)
Rolf Eike Beer (developer)
2015-09-23 05:42

The tread support is more something of the C library than of the compiler, at least for those platforms where it really makes a difference, e.g. you may not get any thread support at all if you have a minimal C library on embedded systems while still running gcc. It's indeed irrelevant for MSVC as you are basically coupled with a specific C runtime when using this compiler, but that's not the case for other platforms.

The limitation to C should be gone now, there are patches in next that should make FindThreads.cmake work in projects where only C++ is enabled.
(0039480)
Brad King (manager)
2015-09-25 10:15

Eike's topic to fix FindThreads with only CXX enabled has been merged to 'master' here:

 Merge topic 'Threads-CXX'
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=910ea210 [^]
(0040419)
Robert Maynard (manager)
2016-02-01 09:10

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

 Issue History
Date Modified Username Field Change
2014-05-05 13:57 Robert Maynard New Issue
2015-09-10 14:18 Brad King Relationship added related to 0015723
2015-09-10 16:45 Brad King Note Added: 0039403
2015-09-23 05:42 Rolf Eike Beer Note Added: 0039474
2015-09-25 10:15 Brad King Note Added: 0039480
2015-09-25 10:15 Brad King Assigned To => Rolf Eike Beer
2015-09-25 10:15 Brad King Status new => resolved
2015-09-25 10:15 Brad King Resolution open => fixed
2015-09-25 10:15 Brad King Fixed in Version => CMake 3.4
2015-09-25 10:15 Brad King Target Version => CMake 3.4
2016-02-01 09:10 Robert Maynard Note Added: 0040419
2016-02-01 09:10 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team