[CMake] Fortran 90 module output directories, dependency analysis

Jed Brown jed at 59A2.org
Tue Jun 1 11:06:28 EDT 2010


On Tue, 1 Jun 2010 08:43:43 -0600, "Kelly Thompson" <kgt at lanl.gov> wrote:
> This can be done using a Fortran compile option.  For gfortran, add the
> option "-M<dir>" to CMAKE_Fortran_FLAGS.  

Sure, however

1. One should use -J instead because (since 4.0), "-M is deprecated to
   avoid conflicts with existing GCC options."

2. It only works for gfortran, this is a serious problem if you have to
   support a lot of vendor compilers.  Simply copying the module file to
   the desired destination is a much better solution.

3. The dependencies become even more broken, CMake needs to know where
   this file is generated and what rule is used to produce it.  Hacking
   this in with compiler-specific flags will prevent CMake from knowing
   about it and generating correct build rules.

Jed


More information about the CMake mailing list