[CMake] Mixing C/CPP and Fortran
Alin M Elena
alinm.elena at googlemail.com
Tue May 26 13:01:17 EDT 2009
Hi All,
I try to mix some C and Fortran (I know not such a good idea).
Anyhow I create a project and then use cmake to manage the build. (see attach)
C is the main language, if I may say so, It links.
I get a linking error
Linking C executable bin/testme
/usr/bin/cmake -E cmake_link_script CMakeFiles/testme.dir/link.txt --verbose=1
/usr/bin/gcc -fPIC CMakeFiles/testme.dir/source/main.c.o -o bin/testme -
rdynamic lib/libhello.a
lib/libhello.a(libhello.f90.o): In function `hello':
libhello.f90:(.text+0x43): undefined reference to `_gfortran_st_write'
libhello.f90:(.text+0x59): undefined reference to
`_gfortran_transfer_character'
libhello.f90:(.text+0x71): undefined reference to `_gfortran_transfer_integer'
libhello.f90:(.text+0x7d): undefined reference to `_gfortran_st_write_done'
collect2: ld returned 1 exit status
make[2]: *** [bin/testme] Error 1
make[2]: Leaving directory `/home/alin/playground/mixCFortran/build'
make[1]: *** [CMakeFiles/testme.dir/all] Error 2
make[1]: Leaving directory `/home/alin/playground/mixCFortran/build'
make: *** [all] Error 2
The problem is very easy solvable by just linking against the fortran runtime
libs (/usr/lib64/libgfortran.so) in this case (gnu compilers).
My question is. Shouldn't cmake handle this internally, so the user does not
bother about?
regards,
Alin
--
______________________________________________________________________
"If the Universities will not study useless subjects, who will?"
G. F. FitzGerald, Nature, 45/46, 392 (1892)
______________________________________________________________________
Mr Alin M ELENA
Irish Centre for High-End Computing -- www.ichec.ie
The Design Tower, Trinity Technology & Enterprise Campus
Grand Canal Quay, Dublin 2, Ireland
Tel: +353 (0) 1 5241608 ext 29
Fax: +353 (0) 1 7645845
http://alin.elenaworld.net
alin.elena at ichec.ie
alinm.elena at gmail.com
______________________________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mixCFortran.tar.bz2
Type: application/x-bzip-compressed-tar
Size: 4922 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090526/c69b4c8d/attachment.bin>
More information about the CMake
mailing list