[CMake] Compiling Fortran Modules And

Yngve Inntjore Levinsen yngve.levinsen at gmail.com
Wed May 15 05:47:39 EDT 2013


Den 13. mai 2013 20:08, skrev Pritchett-Sheats, Lori:
> Each dir* has *.F files that must be preprocessed to *.f90 files and
> then compiled.

Hi,

Just to give my two cents here. The standard filenaming scheme for
fortran files are unless otherwise specified in the
compile/preprocessing flags (as far as I know):

.f/.f77: Fortran 77 files.
.f90/.f95: Fortran 90/95 files.

With lowercase 'f' the files are not supposed to be preprocessed, with
uppercase 'F' the files should be preprocessed. Hence for Fortran 90
code which must be preprocessed, the filename ending should be .F90. The
compiler will then take care of preprocessing (this is true for ifort
and gfortran, I expect most compilers understand this). Alternatively
for e.g. gfortran, the compile flag -cpp will preprocess a .f90 file as
well before compiling.

Hence, I do not quite understand why you don't use the file ending .F90
instead and just compile them directly? This is not directly related to
cmake but it would make the cmake scripts easier because you don't need
to create any custom commands.

Cheers,
Yngve


More information about the CMake mailing list