[CMake] Running cmake multiple times to resolve cache variables

Luke Kucalaba lkucalaba at dsci.com
Fri Oct 10 11:15:28 EDT 2008


I think the reason we need to run cmake.exe multiple times is because we
typically have a "main" project that automatically sets the options of
dependent projects.  For example, our main executable project has an
option "ENABLE_NETWORKING", which then triggers automatic changes for
various global CACHE variables that are used in subdirectories
(sub-projects) that have already been processed (using CACHE STRING
FORCE).  This requires the user to run cmake.exe again to reprocess
those subdirectories.  Is this not something that we should be doing?
Or am I not understanding how the multiple passes of cmake works?

Luke

-----Original Message-----
From: Bill Hoffman [mailto:bill.hoffman at kitware.com] 
Sent: Friday, October 10, 2008 11:12 AM
To: Luke Kucalaba
Cc: cmake at cmake.org
Subject: Re: [CMake] Running cmake multiple times to resolve cache
variables

Luke Kucalaba wrote:
> I have a question about knowing when you have run cmake enough times
to 
> resolve all the cache variables for a project.  In the CMake
explanation 
> on the main website, regarding generation using the cmake.exe program 
> from the command-line in non-interactive mode, it says "It can be 
> difficult to know when to stop the run cmake, edit the cache file
cycle 
> without the aid of an interface."  Yet when you run the interactive 
> version of cmake (CMakeSetup or ccmake), the program detects when you 
> have resolved all cache variables (for example, CMakeSetup uses 
> color-coding, red=not resolved, gray=resolved), and will not even let 
> you generate projects/makefiles until all cache variables are resolved

> (grayed).  Why hasn't this detection capability been added to
cmake.exe 
> for non-interactive mode?  And why does the cmake.exe in
non-interactive 
> mode generate "intermediate" build files that are not "fully
generated" 
> because you haven't yet resolved all the cache variables, yet the 
> interactive versions don't even generate build files until the very 
> final step?
> 
>  

Not sure this makes sense.   The new variables show up in the cache with

a default value.   Since you are running from the command line there is 
no way to change the default value, so there is no reason to run cmake 
again (nothing is going to change.).  With the gui's the user is 
presented with new cache values and given the chance to change them.

-Bill


More information about the CMake mailing list