[CMake] mixed Fortran/C{++} executables
Nico Schlömer
nico.schloemer at gmail.com
Thu Dec 30 15:25:45 EST 2010
Hi all,
another one on mixed Fortan/C{++} executables here.
Suppose you have one C{++} source file, a Fortran one, and a C{++}
main. They all need to be compiled and linked into an executable.
There are different situations where CMake doesn't do what I expected:
(* All GCC, the linker is gfortran. All is fine.)
* All GCC, the linker is g++. CMake doesn't seem to account to for
linking against libgfortran.a.
* All Intel. When compiling with icc, the Fortran standard library
needs to be manually added just like with GCC.
* All Intel. When compiling with ifort, the mandatory options
"-nofor-main -lstdc++ " need to be manually specified. Otherwise, one
has two MAIN_ routines.
For GCC, the "solution" now is to force Fortran a linker language.
Well, I suppose there's some switch I forgot to set, and maybe one of
you can help me out.
Of all those situations, I'm most interested in solutions to the last one.
Cheers,
Nico
More information about the CMake
mailing list