[CMake] Can't set CMAKE_Fortran_FLAGS ?

Maik Beckmann beckmann.maik at googlemail.com
Thu May 1 13:18:50 EDT 2008


Am Donnerstag 01 Mai 2008 19:04:39 schrieb Convey Christian J NPRI:
> I'm using cmake version 2.7-20080501, and I'm having trouble setting
> CMAKE_Fortran_FLAGS.  Any suggestions about what I'm doing wrong?
>
> Here's my CMakeLists.txt file:
>
> SET(CMAKE_Fortran_COMPILER "/usr/bin/f77")
> SET(CMAKE_Fortran_FLAGS "-fno-backslash")

This is a very bad idea.  This way you hardcode the build script towards your 
installation.

Do it this way:
  1. set the environment variable FC to the compiler you want to use
  2. set the environment variable FFLAGS to the flags you want to use
  3. run cmake

In your case this means
 1. $ export FC=/usr/bin/g77
 2. $ export FFLAGS=" -no-backslash"
 3. $ mkdir /path/to/builddir && cd /path/to/builddir && cmake /path/to/srcdir

HTH
 -- Maik
 









More information about the CMake mailing list