[CMake] Problem with Fortran conditionals

Brad King brad.king at kitware.com
Fri May 1 08:37:47 EDT 2015


On 05/01/2015 02:56 AM, Arjen Markus wrote:
> On 04/30/2015 06:04 PM, Nikolaus Rath wrote:
>> I am not sure why CMake is trying to copy module files around

It is copying the module to a timestamp file so that dependents
don't have to rebuild if the module content didn't really change.
Even if CMake didn't try to copy the module it would still be
recording a dependency on a file that is not generated and the
build would stop a bit later.

>> I looked at the file that provides the "dagmg_pardiso" module, I found
>> this code:
>> 
>> !DEC$ IF DEFINED(_MKL_)
>>   MODULE dagmg_PARDISO
> 
> I think the parser for Fortran sources indeed does not take care
> of such conditionals

Correct.  That kind of conditional looks like a Fortran comment
to the CMake parser because it is a compiler-specific extension.
CMake does handle standard conditional blocks.

If anyone wants to try to teach CMake's parser about this kind
of conditional, the entry point to parsing is here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmDependsFortran.cxx;hb=v3.2.2#l172

and the lexer and parser generator sources are here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmDependsFortranLexer.in.l;hb=v3.2.2
 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmDependsFortranParser.y;hb=v3.2.2

-Brad



More information about the CMake mailing list