[cmake-developers] [CMake 0011910]: FindOpenMP.cmake requires both C and CXX

Mantis Bug Tracker mantis at public.kitware.com
Tue Mar 1 03:58:54 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=11910 
====================================================================== 
Reported By:                Raymond Wan
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   11910
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-03-01 03:58 EST
Last Modified:              2011-03-01 03:58 EST
====================================================================== 
Summary:                    FindOpenMP.cmake requires both C and CXX
Description: 
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]



Steps to Reproduce: 
Have a PROJECT () line with just CXX and no C enabled.

Additional Information: 
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.


====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-03-01 03:58 Raymond Wan    New Issue                                    
2011-03-01 03:58 Raymond Wan    File Added: FindOpenMP.2-8-4.patch              
     
======================================================================




More information about the cmake-developers mailing list