Module dependency with Fortran code (avoiding compilation cascades)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Module dependency with Fortran code (avoiding compilation cascades)

Angel de Vicente

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         
ADVERTENCIA: Sobre la privacidad y cumplimiento de la Ley de Protección de Datos, acceda a
WARNING: For more information on privacy and fulfilment of the Law concerning the Protection of Data, consult


Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: