[CMake] [PATCH] slightly modify cache variable behaviour, Was: Re: option() behavior

Brad King brad.king at kitware.com
Mon May 11 13:34:27 EDT 2009


Bill Hoffman wrote:
> So, CMake has done what it does now from the start.   There was a short 
> period of time when it did not, and that was when a re-write was done, 
> and it quickly broke some existing projects.  Here is the thread:
> 
> http://www.cmake.org/pipermail/cmake/2007-March/013204.html
> 
> I think the rule should be if you want to change a variable you have to 
> have the set AFTER the variable, or use CACHE INTERNAL.

I agree.  Code should first get the cache in order, then get the local
variable in order.  Often one can get away without mucking with cache
values locally.  After all, if the user writes -DABC=xyz he would expect
that value to be used.  If a project is 'smarter' than the user in some
cases, then the code should be written carefully using the above policy.

-Brad


More information about the CMake mailing list