[CMake] Strange behaviour with -D option

pellegrini pellegrini at ill.fr
Fri Jul 1 06:02:08 EDT 2011


Hello everybody,

there is a behaviour I do not understand when using cmake with -D option.

In my project I defined a few CACHE variables. One of them is GUI to 
specify whether or not my project should be
built with graphical library support.

So in my main CMakeLists.txt I wrote something like:

SET(GUI FALSE CACHE BOOL "do the build in GUI mode")
PROJECT(crysfml Fortran)
...

When launching cmake with:
cmake -G "NMake Makefiles" -D CMAKE_Fortran_COMPILER=ifort -D GUI=TRUE 
..\..\.

I always get the following message

#################################################################
GUI VALUE =  TRUE
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_Fortran_COMPILER= ifort

-- The Fortran compiler identification is Intel
-- Check for working Fortran compiler: 
C:/Intel/Compiler/11.1/054/bin/ia32/ifort.exe
-- Check for working Fortran compiler: 
C:/Intel/Compiler/11.1/054/bin/ia32/ifort.exe  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether C:/Intel/Compiler/11.1/054/bin/ia32/ifort.exe 
supports Fortran 90
-- Checking whether C:/Intel/Compiler/11.1/054/bin/ia32/ifort.exe 
supports Fortran 90 -- yes
GUI VALUE = FALSE
-- Configuring done
-- Generating done
-- Build files have been written to: 
C:/Datas/Eclipse/workspace/crysfml/build/ifort_release_win
#################################################################

and the worse it that when deleting the cache and rebuilding it, the GUI 
variable is switched to FALSE as you can see in the two MESSAGE commands 
I put in my code (GUI VALUE =). Though, I would tend to think that the 
-D command should have the last word.

There should be something I completely missed.

thanks a lot

see you

Eric


-- 
Eric Pellegrini
Calcul Scientifique
Institut Laue-Langevin
Grenoble, France



More information about the CMake mailing list