<p>Use something like<br>
SET (GUI ${GUI} CACHE BOOL "description")<br>
To put proper initial value from command line into cache. It won't be overwritten on the second run.</p>
<p>On Jul 1, 2011 2:02 PM, "pellegrini" <<a href="mailto:pellegrini@ill.fr">pellegrini@ill.fr</a>> wrote:<br type="attribution">> Hello everybody,<br>> <br>> there is a behaviour I do not understand when using cmake with -D option.<br>
> <br>> In my project I defined a few CACHE variables. One of them is GUI to <br>> specify whether or not my project should be<br>> built with graphical library support.<br>> <br>> So in my main CMakeLists.txt I wrote something like:<br>
> <br>> SET(GUI FALSE CACHE BOOL "do the build in GUI mode")<br>> PROJECT(crysfml Fortran)<br>> ...<br>> <br>> When launching cmake with:<br>> cmake -G "NMake Makefiles" -D CMAKE_Fortran_COMPILER=ifort -D GUI=TRUE <br>
> ..\..\.<br>> <br>> I always get the following message<br>> <br>> #################################################################<br>> GUI VALUE = TRUE<br>> -- Configuring done<br>> You have changed variables that require your cache to be deleted.<br>
> Configure will be re-run and you may have to reset some variables.<br>> The following variables have changed:<br>> CMAKE_Fortran_COMPILER= ifort<br>> <br>> -- The Fortran compiler identification is Intel<br>
> -- Check for working Fortran compiler: <br>> C:/Intel/Compiler/11.1/054/bin/ia32/ifort.exe<br>> -- Check for working Fortran compiler: <br>> C:/Intel/Compiler/11.1/054/bin/ia32/ifort.exe -- works<br>> -- Detecting Fortran compiler ABI info<br>
> -- Detecting Fortran compiler ABI info - done<br>> -- Checking whether C:/Intel/Compiler/11.1/054/bin/ia32/ifort.exe <br>> supports Fortran 90<br>> -- Checking whether C:/Intel/Compiler/11.1/054/bin/ia32/ifort.exe <br>
> supports Fortran 90 -- yes<br>> GUI VALUE = FALSE<br>> -- Configuring done<br>> -- Generating done<br>> -- Build files have been written to: <br>> C:/Datas/Eclipse/workspace/crysfml/build/ifort_release_win<br>
> #################################################################<br>> <br>> and the worse it that when deleting the cache and rebuilding it, the GUI <br>> variable is switched to FALSE as you can see in the two MESSAGE commands <br>
> I put in my code (GUI VALUE =). Though, I would tend to think that the <br>> -D command should have the last word.<br>> <br>> There should be something I completely missed.<br>> <br>> thanks a lot<br>> <br>
> see you<br>> <br>> Eric<br>> <br>> <br>> -- <br>> Eric Pellegrini<br>> Calcul Scientifique<br>> Institut Laue-Langevin<br>> Grenoble, France<br>> <br>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>> <br>> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
> <br>> Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br>> <br>> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></p>