[CMake] ccmake and fortran
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Sat Aug 12 11:48:03 EDT 2006
On 2006-08-12 07:01-0700 bpwlist at cox.net wrote:
> My knowledgebase of fortran lies with fixed format f77 fortran, so your
right the solution below only works for fixed format Fortran. There is
currently nothing in the .l file to set the <fixed_fmt> state, so the line:
> <fixed_fmt>^[cC*dD].*\n { return EOSTMT; }
> never gets triggered. Having only worked with fixed format fortran and
not having a newer fortran book on my book shelf... How does the compiler
determine whether a file is fixed or free format? A test needs to be put in
the .l file to determine whether fixed or free format fortran is being used.
It is a real mess because it varies from one fortran compiler to another and
from one version to the next. One approach would be to create a knowledge
base of the various rules for determining fixed or free format for each
fortran compiler (including suffix default rules and compiler options),
but I think that just propagates the mess to CMake, and it would be a
nightmare to maintain as the various fortran compilers kept changing in this
respect.
Here is an alternative I wish you would consider instead. According to the
SET_SOURCE_FILES_PROPERTIES documentation users can make up their own
properties for source files so I suggest you assume the users has specified
a BOOL property called FORTRAN_FIXED_FORM when their fortran source file is
in fixed form. Then you only have to interrogate this source-code property
and set fixed_fmt accordingly. (Note, I have glossed over the
implementation details because I am unaware of those details.) When
documenting the FORTRAN_FIXED_FORM property you would have to make it clear
that this was only to help CMake parse the fortran source and it is the
user's additional responsibility to figure out the compiler options for
specifying fixed form to the fortran compiler of their choice.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
More information about the CMake
mailing list