The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14567 
====================================================================== 
Reported By:                Daniel Landau
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14567
Category:                   Modules
Reproducibility:            always
Severity:                   tweak
Priority:                   low
Status:                     new
====================================================================== 
Date Submitted:             2013-11-13 12:48 EST
Last Modified:              2013-11-13 12:48 EST
====================================================================== 
Summary:                    FindOpenMP is incorrect for compilers that accept
OpenMP with no flags
Description: 
The CMake FindOpenMP.cmake module tries several flags in order to find out which
one is supported by the compiler. The way it does it is seems to be by testing
whether a compilation returns a successful exit status. The overall effect is
that since "-openmp" is tested for before " ", the former gets chosen as the
flag for OpenMP when the compiler doesn't require any.

The practical problem here is that the compiler that accepts "-openmp" without
intending for it to signify OpenMP interpretes that as "-o penmp". This is not
as big a problem as it first sounds, because CMake usually includes another -o
flag later in the command line. In fact, I couldn't produce a small test case
where this would lead to problems. It does lead to problems in the real word
case of molecular dynamics software Gromacs (http://www.gromacs.org/), where
some linking steps get generated with the order of first the intended -o flag
and later -openmp.

A simple fix is to simply swap the order of testing for no flag (" ") and
"-openmp".

Steps to Reproduce: 
Any simple CMakeLists.txt with OpenMP and a compiler that accepts OpenMP without
flags (I used the Cray compiler) will produce compilation commands with -openmp,
but I couldn't generate a small test case where that leads to explicit problems.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-11-13 12:48 Daniel Landau  New Issue                                    
======================================================================

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to