[CMake] CMakeSetup allows you to generate even though advanced variables have added or changed

Brad King brad.king at kitware.com
Wed Apr 6 13:44:01 EDT 2005


Paul Smyth wrote:
> Hi folks again,
> I've just noticed (in 2.0.5) that if you tell the CmakeSetup GUI (in
> windows) not to show advanced values, then the OK button will become
> enabled if after a run of Configure, even though some advanced variables
> have appeared. Also, if variables have changed at the last configure
> run, OK can also become enabled.
> 
> I presume the first point at which the OK button should be enabled is
> the point at which no cache variables (internal,advanced or
> non-advanced) have been added/removed/changed in the last run of
> configure, and therefore generation can safely occur.

This used to be the case but we had too many users complaining that they 
had to press the configure button 10 times before OK would be enabled. 
It is confusing to many users to have no non-advanced variables "red" 
and have the OK button off.  There was a design decision to make the 
test less strict.

Most of the time the current test works well.  Usually only advanced 
users setup situations in which it really isn't safe to generate when 
the OK button is on.

> I'm writing some Cmake stuff that makes big changes depending on the
> values of cache vars at the previous iteration. I'm finding that the OK
> button is enabled prematurely for my application.
> 
> Would it make sense to make the OK button-enabling much stricter, to
> prevent premature generation? [I'm very happy to do it].

When there is a premature generation state then it means the user needs 
to change something.  Your CMakeLists.txt code should be able to detect 
this bad state and produce a MESSAGE using the ERROR tag.  The fact that 
an error has occurred will leave the OK button disabled.  Meanwhile the 
message will have informed the user of why.

-Brad


More information about the CMake mailing list