Module dependency with Fortran code (avoiding compilation cascades)
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?