[CMake] #include and fortran dependencies

Brad King brad.king at kitware.com
Tue Feb 28 13:28:19 EST 2012


On 2/28/2012 11:06 AM, Dirk vanMeeuwen wrote:
> #include "fpp-Windows-definition.inc"
> MODULE MSG
> ...
> END MODULE
>
> However, when this module MSG is used, the project build order
 > generated by CMake is not correct (see attached small example).

Fortran dependencies are supported, and the Intel Fortran 12 compiler
is expected to work with the NMake Makefiles generator.

I was able to reproduce the problem.  If I remove the #if logic from
the .inc file then it works.  I think this may be a bug in the
Source/cmDependsFortran* files of CMake.  It is not handling the #if
logic correctly and tricks itself into thinking that all the code
after the #include line is being preprocessed out as if in "#if 0".
That's why the order of the lines affects the results.

I don't have time to investigate this myself but if anyone is
interested then take a look at Source/cmDependsFortranParser.y
and Source/cmDependsFortran.cxx for use of the _RuleIf, _RuleElse,
and similar functions.

-Brad


More information about the CMake mailing list