[CMake] 1 tricky question, 1 bug report

Brad King brad.king at kitware.com
Fri Mar 13 11:51:33 EDT 2009


Bill Hoffman wrote:
>> The following Fortran code cannot be compiled with CMake, because
>> CMake looks for module called "name", which of course, does not exist.

Actually it thinks the source is defining a module called "name".

>> If I replace "Module" with "_Module_" the code compiles.
>> =============forbug.f
>> C    Line 1  (Output)   ; Module name

Use '!' for comments to work around the bug.

> Try CMake 2.6.3, I am pretty sure we fixed the fortran comment module
> issue.

The issue we fixed is when "USE" appears in a comment, not "MODULE":

  http://www.cmake.org/Bug/view.php?id=5809

If the '!' form of comment is used then the lexer can fully discard
comments because they are comments in both fixed-form and free-form.
(BTW, more fortran compilers support '!' than 'C' ... I had to fix
our test for this to use '!' or it broke on some compilers.)

Actually, I cannot tell from a quick glance at the code how it ignores
'USE' keywords that appear after a ';' separator.  It does not ignore
'MODULE' after ';'.  Maik?

The full fix is of course to discard 'C'-prefixed comments completely,
but that can only be done in fixed-form sources.  Currently our lexer
has code to support fixed-form files but it is never enabled.  CMake
does not know whether a source file is fixed-form or free-form.  We
may have to create a source file property to specify it, much like
some compilers require a flag.  Other suggestions?

-Brad


More information about the CMake mailing list