[CMake] fortran, modules and case

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed May 16 17:06:50 EDT 2007


On 2007-05-16 12:19-0600 Andrew Brydon wrote:

>
> Hi,
> 	I am trying to port a large existing fortran library to using cmake, 
> and have come up against a problem with the use of inconsistent module cases 
> in the code (this is permitted in fortran).
>
> I believe the logic in the existing fortran dependancy scanner does not 
> consistently change the case of modules. The .mod.proxy targets are sometimes 
> changed to lower case, but at other times the case of the source code is 
> used. I've attached a small example with two modules that use inconsistent 
> module access and fail to compile with the latest cmake from cvs as follows
>
> blanco:~/tmp/cmake_f90/_build/cmake2.4 abrydon$ make
> Scanning dependencies of target hello_mods
> make[2]: *** No rule to make target `hello1.mod.proxy', needed by 
> `CMakeFiles/hello_mods.dir/main.o.requires'.  Stop.
> make[1]: *** [CMakeFiles/hello_mods.dir/all] Error 2
> make: *** [all] Error 2
>
>
> I've attached a patch to cmDependsFortran.cxx which seems to fix the problem 
> in both the simple example and the existing package.

Hi Andrew:

Just out of curiosity I tried your patch (to 2.4.6) to see whether it would
make any difference to bug 3984, "A fortran 95 module dependency issue".
As expected (everything is in lower case in the attached simple example), it
makes no difference.

Since you have recently looked through the code in question, can you find
a solution for bug 3984?

The illustrative simple example (see attached tarball) in that case creates
a fortran 90 library which consists of a routine to print "hello world", and a
fortran 90 executable that calls that library routine.

The link of the the executable fails with the following message:

*** No rule to make target hello_module.mod.proxy', needed by
CMakeFiles/hello_program.dir/hello_program.o.requires'.  Stop.

The ugly workaround for this bug is to create that required file using

touch hello_module.mod.proxy.

Hope you can find a bug fix for this case as well.

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 libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_fortran_module.tar.gz
Type: application/octet-stream
Size: 427 bytes
Desc: Bug #3984 simple example tarball
Url : http://public.kitware.com/pipermail/cmake/attachments/20070516/75bee7d8/test_fortran_module.tar.obj


More information about the CMake mailing list