[CMake] Fortran bugs/Mixed C/CXX/Fortran/Silly Questions?

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed Nov 29 20:39:15 EST 2006


On 2006-11-24 12:30-0800 Alan W. Irwin wrote:

> * For our fortran 77 library and examples code we replace "use" and "module"
> in comments with something else such as "_use_" and "_module_"). This works
> around a bug in CMake (bug #3109,
> http://www.cmake.org/Bug/bug.php?op=show&bugid=3109) that processes (rather
> than ignores which would be the correct thing to do) fortran 77 comments
> when trying to figure out module dependencies.

Ugh, just ran into this cmake-2.4.4 bug again when changing the build system
of the FreeEOS project (freeeos.sf.net) from autotools to cmake.
Unfortunately, " use " occurs with high frequency in comments so virtually
every fortran 77 source file (there are ~60 of them) was affected by this
cmake bug.

Here is a one-line sed script that I used to automate the workaround.

irwin at chickadee> cat cmake_module_fixup.sed
/^[cC]/s? \(use\) ?_\1_?gi

The trailing i option is important since it preserves the case in the result.

*After backing up my source files*, I then used the following command-line
to convert all my *.f files:

for FILE in  *.f; do echo $FILE; mv $FILE test.f ; sed -f
cmake_module_fixup.sed <test.f > $FILE; rm -f test.f; done

I can now build the fortran library for this project using cmake which means
I am almost done with the conversion.

The above script is easy to modify to replace "_use_" by " use " while
preserving case, i.e., to reverse this ugly workaround once bug 3109 has
been fixed.  I hope to do this for both the FreeEOS and PLplot projects
sooner rather than later.

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