[CMake] Re: Fortran Flags

Baptiste Derongs baptiste.derongs at gmail.com
Fri Nov 30 05:28:40 EST 2007


On Nov 29, 2007 6:17 PM, Alan W. Irwin <irwin at beluga.phys.uvic.ca> wrote:
>
> 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.

Actually my problem didn't come from what I thought.
The point is that INCLUDE_DIRECTORIES does not seem to work with Fortran.
When I use this command, the CMakeDirectoryInformation.cmake show that
the CMAKE_C_INCLUDE_PATH variable is set, but there is no
CMAKE_Fortran_INCLUDE_PATH variable, so the linking is missing include
directories...

I tried to set CMAKE_Fortran_INCLUDE_PATH, but apparently it does not exist.

Is there any other way to set include directories in Fortran ?

Regards

Baptiste


More information about the CMake mailing list