[CMake] Compiling Fortran Modules And

Pritchett-Sheats, Lori lpritch at lanl.gov
Wed May 15 12:13:04 EDT 2013


Yes the files are not following the file extension standards. This is a legacy project from the late 1990s, early 2000s. 

I did change the file extensions to *.F90 to work around my current problem to move forward with other tasks and I discovered that while ifort pre-processed files the code wouldn't build in parallel. I also tried gfortran, however the files were not preprocessed correctly and could not compile, likely due to code issues not GNU fortran.

With Brad King's fix, I'm keeping the extra preprocessing command because I build in parallel.


Lori A. Pritchett-Sheats
Los Alamos National Laboratory
CCS-2, Computational Physics
505-665-6675

________________________________________
From: cmake-bounces at cmake.org [cmake-bounces at cmake.org] on behalf of Yngve Inntjore Levinsen [yngve.levinsen at gmail.com]
Sent: Wednesday, May 15, 2013 3:47 AM
To: cmake at cmake.org
Subject: Re: [CMake] Compiling Fortran Modules And

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
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list