[CMake] adjusting CMAKE_Fortran_LINK_EXECUTABLE
Ilias Miroslav
Miroslav.Ilias at umb.sk
Thu Mar 10 03:48:34 EST 2011
Ad: http://www.mail-archive.com/cmake@cmake.org/msg34968.html
Dear Bill,
------------------------------------------
By default, the current CMAKE_Fortran_LINK_EXECUTABLE consists of several variables:
"<CMAKE_Fortran_COMPILER> <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET>
<LINK_LIBRARIES>"
We would like to know how to restrict the CMAKE_<compiler>_LINK_EXECUTABLE parameter to selected variables only: "<LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
----------------------------------------
The problem lies with the (recent stable) g95 compiler: the linking step with the optimization flag, -ffast-math , reports missing object crtfastmath.o in the g95-set.
Linking Fortran executable dirac.x
/usr/bin/g95 -fno-second-underscore -i8 -O3 -ffast-math -fsloppy-char CMakeFiles/dirac.x.dir/dft/fun-pz81.c.o...
.
.
.... CMakeFiles/dirac.x.dir/eri/fck3ftuv.F.o CMakeFiles/dirac.x.dir/pdpack/gpblas.F.o -o dirac.x -L/usr/lib/gcc/x86_64-linux-gnu/4.4.5 lib/libxcfun.a
ld: crtfastmath.o: No such file: No such file or directory
If one could avoid the <CMAKE_Fortran_LINK_FLAGS>( -fno-second-underscore -i8 -O3 -ffast-math -fsloppy-char) parameter in the linking step, containing the problematic -ffast-math, one would get the executable without problem. The "-ffast-math"flag works for compilation of fortran source codes, but is unsuitable for g95-linking in this case.
Best, Miro
More information about the CMake
mailing list