[CMake] Re: Fortran Flags

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Nov 29 12:17:04 EST 2007


On 2007-11-29 11:22+0100 Baptiste Derongs wrote:

> Hum...sorry for that, too fast on the keyboard...
>
>> Hello all,
>>
>> I'm currently trying to compile some fortran programs. I need to pass
>> them some flags (actually mpif90 script flags).
>
> I give flags by setting CMAKE_Fortran_FLAGS variable.
>
> I looked at CMakeFiles/<my executable>.dir/flags.txt, it looks good.
> But then I get somme errors during linking step, 'undefined
> reference'. It only apperars during the build of the final executable
> from objects files.
>
> So I looked in build.make file, and I see that during this step, the
> command is :
>
> ifort <FLAGS> $(OBJECTS) -o <Final executable>
>
> And when I try this command by my self, it returns the same errors, to
> get my executable the right order is :
>
> ifort $(OBJECT) <FLAGS> -o <Final executable>
>
> Is there something to set in my Cmake file to get the right order ?

On my Linux system, I can look up the Linux and Windows ifort build rules in

/usr/share/cmake-2.4/Modules/Platform/Linux-ifort.cmake and
/usr/share/cmake-2.4/Modules/Platform/Windows-ifort.cmake .

The order you refer to above seems to come from the latter file.  Assuming
you have a windows system, you will have to find that file and change the
order to what you want.  And once that works, send the patch to the
list so it can be made a permanent CMake change so you don't have to
apply the change to every new version of CMake that you build.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list