[CMake] [Fortran][Intel][Windows] mixed up default flags

Maik Beckmann beckmann.maik at googlemail.com
Tue Jul 21 10:27:33 EDT 2009


This is what ifort /help has to say
{{{
/O1       optimize for maximum speed, but disable some optimizations which
          increase code size for a small speed benefit
/O2       optimize for maximum speed (DEFAULT)
/O3       optimize for maximum speed and enable more aggressive optimizations
          that may not improve performance on some programs
/Ox       enable maximum optimizations (same as /O2)
/Os       enable speed optimizations, but disable some optimizations which
          increase code size for small speed benefit (overrides /Ot)
/Ot       enable speed optimizations (overrides /Os)
/Od       disable optimizations
}}}

and this is what cmake does:
{{{
SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp")
SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full")
SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG")
SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/MD /O1 /D NDEBUG")
SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG")
}}}

What we really want is
{{{
SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp")
SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/Od /debug:full")
SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/Os /D NDEBUG")
SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/MD /O3 /D NDEBUG")
SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /debug:full /D NDEBUG")
}}}
or even better with the changes of
http://public.kitware.com/Bug/view.php?id=8744
{{{
SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads")
SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/Od /debug:full  /dbglibs")
SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/Os")
SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O3 /D NDEBUG")
SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /debug:full")
}}}


@Bill Hoffman: I don't see any progress on the bug report mentioned
above as well as on http://public.kitware.com/Bug/view.php?id=9241.
In case your are to busy right now I like to volunteer as maintainer for
  - Platform/Windows-ifort.cmake
  - Platform/Linux-Intel-Fortran.cmake
  - Platform/Linux-SunPro-Fortran.cmake
  - Platform/Linux-GNU-Fortran.cmake
What do you think?

Best,
 -- Maik


More information about the CMake mailing list