MantisBT - CMake
View Issue Details
0011910CMakeModulespublic2011-03-01 03:582012-07-09 06:52
Raymond Wan 
Rolf Eike Beer 
normalminoralways
closedfixed 
AMD64Debian6.0
CMake-2-8 
CMake 2.8.8CMake 2.8.8 
0011910: FindOpenMP.cmake requires both C and CXX
If only CXX is enabled and not C, then many errors are produced that look like this (path shortened):

-- Performing Test OpenMP_FLAG_DETECTED
CMake Error: Unknown extension ".c" for file ".../build/CMakeFiles/CMakeTmp/src.c". TRY_COMPILE only works for enabled languages.
Currently enabled languages are: CXX
See PROJECT command for help enabling other languages.

Looking at the module, it seems that (1) it performs both the C and CXX tests unconditionally. So if C is not enabled, then the C tests will generate the above error. (2) Also, at the end of the module, the use of find_package_handle_standard_args() seems to require that both C and CXX flags have to be set.

Also, (3) there is a minor problem with the check_c_source_compiles () using the CXX source, and vice-versa. (As the two sources are identical, the effect is trivial.)

-----

Notes:
1) Debian 6.0 is using cmake 2.8.2 . However, looking at 2.8.4, it seems that the problem still persists.
2) A similar problem for an entirely different module appears to be described here: http://www.mail-archive.com/cmake@cmake.org/msg06043.html [^]]

Have a PROJECT () line with just CXX and no C enabled.
Attached is a diff file with changes that hopefully addresses the 3 problems above by performing the test only if either the C or CXX compiler is defined. The diff file is generated against the newer 2.8.4 and not the 2.8.2 that I'm using.

As I'm not experienced with cmake, hopefully it is correct and of some help.

No tags attached.
patch FindOpenMP.2-8-4.patch (3,209) 2011-03-01 03:58
https://public.kitware.com/Bug/file/3732/FindOpenMP.2-8-4.patch
Issue History
2011-03-01 03:58Raymond WanNew Issue
2011-03-01 03:58Raymond WanFile Added: FindOpenMP.2-8-4.patch
2012-02-06 07:42JustinNote Added: 0028515
2012-02-08 13:04Rolf Eike BeerNote Added: 0028525
2012-02-08 13:04Rolf Eike BeerAssigned To => Rolf Eike Beer
2012-02-08 13:04Rolf Eike BeerStatusnew => resolved
2012-02-08 13:04Rolf Eike BeerResolutionopen => fixed
2012-02-08 13:04Rolf Eike BeerFixed in Version => CMake 2.8.8
2012-02-08 13:04Rolf Eike BeerTarget Version => CMake 2.8.8
2012-07-09 06:52David ColeNote Added: 0029964
2012-07-09 06:52David ColeStatusresolved => closed

Notes
(0028515)
Justin   
2012-02-06 07:42   
Patch works fine, please apply.
(0028525)
Rolf Eike Beer   
2012-02-08 13:04   
Pushed fix to next:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=81228e9d1d94cb55fa0a75b474c5a3283b39551a [^]

It's not your one, but does the same.
(0029964)
David Cole   
2012-07-09 06:52   
Closing resolved issues that have not been updated in more than 4 months.