CMake Fortran Issues: Difference between revisions
Maikbeckmann (talk | contribs) No edit summary |
Maikbeckmann (talk | contribs) No edit summary |
||
Line 31: | Line 31: | ||
** a.f90 | ** a.f90 | ||
a.f90: | |||
</ | <pre> | ||
SUBROUTINE printHello | |||
write(*,*) "Hello f9x world" | |||
END SUBROUTINE | |||
</pre> | |||
main.f90: | |||
</ | <pre> | ||
PROGRAM hello | |||
CALL printHello | |||
END PROGRAM | |||
</pre> | |||
< | Makefile: | ||
<pre> | |||
all: prog.dir/all | |||
prog.dir/all: | |||
$(MAKE) -f prog.dir/build.make prog.dir/all | |||
</build.make> | clean: | ||
$(MAKE) -f prog.dir/build.make prog.dir/clean | |||
</pre> | |||
build.make: | |||
<pre> | |||
prog.dir/all: prog.dir/prog | |||
prog.dir/prog: prog.dir/a.o prog.dir/main.o | |||
gfortran -o prog.dir/prog prog.dir/a.o prog.dir/main.o | |||
prog.dir/a.o: ../a.f90 | |||
gfortran -o prog.dir/a.o -c ../a.f90 | |||
prog.dir/main.o: ../main.f90 | |||
gfortran -o prog.dir/main.o -c ../main.f90 | |||
prog.dir/clean: | |||
rm prog.dir/a.o prog.dir/main.o prog.dir/prog | |||
</pre> | |||
The current CMake is able to do this without any problems. You can download this example as tarball example_simpleProgram.tar.gz at http://www.cmake.org/Bug/view.php?id=5809 | |||
== A simple Program with Module == |
Revision as of 20:09, 7 October 2007
Introduction
CMake has a number of Fortran issues that have been discussed many different times on list and duplicated a fair number of times in the bug tracker as well.
Maik Beckmann is trying to make sense of all the confusion by collecting information on all Fortran issues at http://www.cmake.org/Bug/view.php?id=5809
Please join the work there by
- Contributing patches.
- Testing the patches that already exist there.
- Reporting things that don't work.
- Sending simplified examples of things which don't work.
- Sharing your expert knowledge of CMake.
Concepts expressed using Makefiles
This section is intended to discuss the makefile rules which CMake has to generate have to look like.
A simple program
A f9x program which is build by compiling in linking two source files a.f90 and main.f90. The tree structure is:
- example_simpleProgram
- build
- Makefile
- prog.dir
- build.make
- main.f90
- a.f90
- build
a.f90:
SUBROUTINE printHello write(*,*) "Hello f9x world" END SUBROUTINE
main.f90:
PROGRAM hello CALL printHello END PROGRAM
Makefile:
all: prog.dir/all prog.dir/all: $(MAKE) -f prog.dir/build.make prog.dir/all clean: $(MAKE) -f prog.dir/build.make prog.dir/clean
build.make:
prog.dir/all: prog.dir/prog prog.dir/prog: prog.dir/a.o prog.dir/main.o gfortran -o prog.dir/prog prog.dir/a.o prog.dir/main.o prog.dir/a.o: ../a.f90 gfortran -o prog.dir/a.o -c ../a.f90 prog.dir/main.o: ../main.f90 gfortran -o prog.dir/main.o -c ../main.f90 prog.dir/clean: rm prog.dir/a.o prog.dir/main.o prog.dir/prog
The current CMake is able to do this without any problems. You can download this example as tarball example_simpleProgram.tar.gz at http://www.cmake.org/Bug/view.php?id=5809