[CMake] cmake do not read my ifort compiler fllags - correct version

Marcel Loose loose at astron.nl
Wed Sep 29 07:03:43 EDT 2010


On Wed, 2010-09-29 at 12:06 +0200, pellegrini wrote:
> Hello everybody,
> 
> I would like to set my own compiler flags to compile a library using 
> intel fortran compiler.
> 
> To do so, I created in my Src/ directory a 
> "Compiler/Intel-Fortran.cmake" file that contains my preferences such
as:
> 
> SET(CMAKE_BUILD_TYPE_INIT Release)
> SET(CMAKE_Fortran_FLAGS_INIT "")
> SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /check /traceback
/nologo")
> SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /nologo /Qvec-report0")
> SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2 /nologo /Qvec-report0")
> SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /nologo /traceback 
> /debug:full")
> SET(CMAKE_Fortran_MODDIR_FLAG "-module ")
> SET(CMAKE_Fortran_VERBOSE_FLAG "-v")
> 
> but, when running cmake and then nmake, the compiler flags used are
not 
> the ones I set but the default ones. I do not
> understand because I used to do the same with g95 and it worked 
> perfectly. By the way, the flags used seem to be the ones
> set in the  "Modules/Platform/Windows-ifort.cmake" cmake distribution,

> as if that file was parsed instead of mine ! However, when I put a 
> message("hello") inside my file, it appears when building the cmake
files.
> 
> would you have any idea ?
> 
> thanks
> 
> Eric
> 
Hi Eric,

Just when exactly do you set these variables. As the name of these
variables suggest, these are initialisation variables. When CMake
processes the PROJECT() command, it also configures the compilers that
you define there (C and C++ by default). After that, none of the changes
you make to these *_INIT variables will be picked up.

HTH,
Marcel Loose.



More information about the CMake mailing list