[CMake] Module dependency with Fortran code (avoiding compilation cascades)

Angel de Vicente angelv at iac.es
Fri Feb 10 09:13:23 EST 2017


Hi,

our project was using hand-made makefiles which were becoming difficult
to maintain, so I decided to migrate to CMake. This is my first time
with CMake, so still testing it, but there is something that I haven't
figured out how to do, namely avoid compilation cascades.

I'm using right now Intel Fortran and the issue with it is that
everytime you make a change in the source code, the generated .mod file
is also created even if the procedures interfaces were not changed at
all. With our hand made makefiles I was keeping a copy of the .mod files
in another directory, then after the .mod file was generated I stripped
the first bytes (to avoid a timestamp that Intel Fortran puts in the
.mod files) and then compared with the old .mod file. If both were
identical I overwrote the new .mod file with the old one, and since
other object files depended on the .mod files (as per the hand-made
written makefile), then no recompilation of other files using that
module was performed.

I was hoping to get similar behaviour with CMake, but without so much
hand-made tweaking (as I read that CMake could do its own dependency
resolution), but I'm not sure how to proceed, as at least now every time
I just modify anything in one of the source files, every module that
uses it is recompiled (recursively all the project up).

Any pointers on how to avoid compilation cascades with Fortran+CMake?

Many thanks,
-- 
Ángel de Vicente
http://www.iac.es/galeria/angelv/          
---------------------------------------------------------------------------------------------
ADVERTENCIA: Sobre la privacidad y cumplimiento de la Ley de Protección de Datos, acceda a http://www.iac.es/disclaimer.php
WARNING: For more information on privacy and fulfilment of the Law concerning the Protection of Data, consult http://www.iac.es/disclaimer.php?lang=en



More information about the CMake mailing list