[CMake] Strange behaviour with -D option
Michael Hertling
mhertling at online.de
Sun Jul 3 02:05:09 EDT 2011
On 07/01/2011 12:02 PM, pellegrini 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
FYI, see [1,2]. ATM, until 9980 is addressed, the best you can do when
changing compilers is throwing away the build tree, starting all over
with a fresh/empty one and specifying the compilers via the CC/CXX/FC
environment variables, the usually recommended way. As an alternative,
provide one build tree per set of compilers from the first. In case of
numerous -D settings, you might use CMake's -C option for convenience.
Regards,
Michael
[1] http://www.mail-archive.com/cmake@cmake.org/msg34486.html
[2] http://public.kitware.com/Bug/view.php?id=9980
More information about the CMake
mailing list