[CMake] Strange behaviour with -D option

Yuri Timenkov yuri at timenkov.ru
Wed Jul 6 14:58:14 EDT 2011


Use something like
SET (GUI ${GUI} CACHE BOOL "description")
To put proper initial value from command line into cache. It won't be
overwritten on the second run.

On Jul 1, 2011 2:02 PM, "pellegrini" <pellegrini at ill.fr> wrote:
> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110706/3f24d8d3/attachment.htm>


More information about the CMake mailing list