[CMake] cmake gfortran-libs linking x86_64

Eric Noulard eric.noulard at gmail.com
Sun Nov 7 06:00:03 EST 2010


2010/11/7 luxInteg <lux-integ at btconnect.com>:
> Greetings,
>
>
>
> I am learning cmake   I have the following gfortran libraries on my computer:-
>
> rt [ ~ ]$
> rt [ ~ ]$ ls -l  /usr/lib/*gfortran*
> -rw-r--r-- 1 root root 8489924 Jul 27 12:19 /usr/lib/libgfortran.a
> -rwxr-xr-x 1 root root     952 Jul 27 12:19 /usr/lib/libgfortran.la
> lrwxrwxrwx 1 root root      20 Jul 27 12:18 /usr/lib/libgfortran.so ->
> libgfortran.so.3.0.0
> lrwxrwxrwx 1 root root      20 Jul 27 12:19 /usr/lib/libgfortran.so.3 ->
> libgfortran.so.3.0.0
> -rwxr-xr-x 1 root root 4104076 Jul 27 12:20 /usr/lib/libgfortran.so.3.0.0
> rt [ ~ ]$
> rt [ ~ ]$ ls -l /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/*gfortran*
> -rw-r--r-- 1 root root 8902 Jul 27 12:18 /usr/lib/gcc/x86_64-unknown-linux-
> gnu/4.4.2/libgfortranbegin.a
> -rwxr-xr-x 1 root root  923 Jul 27 12:18 /usr/lib/gcc/x86_64-unknown-linux-
> gnu/4.4.2/libgfortranbegin.la
> rt [ ~ ]$
>
> QUESTION1: are there envars  to set in a  cmake project  to  enable linking to
> these programs  and if so how so?
> QURSTION2: If QUESTION1 is {no} can one  say set  F_LDFLAGS="-L/usr/lib/ -
> L/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/"  and would it make sense in a
> cmale project?
> QUESTION3: libgfortranbegin is avaibale only as a static library,   can
> fortran shared libraries   still be linked to it?
>
> advice would be appreciated.

What are you trying to do ?

1) Compile & Link some Fortran source for a Fortran project ?
2) Compile & Link some mixed language project like C/Fortran or C++/Fortran ?

Usually when using Fortran you should add

enable_language(Fortran)

for mixed language programming you have the
FortranCInterface cmake module:
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#module:FortranCInterface

If you search the ML archive you will find many discussions related to
Fortran Programming.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list