[cmake-developers] Generator options per-directory v. global (was: CMake 3.7.0-rc1 now ready for testing!)

Brad King brad.king at kitware.com
Wed Oct 5 09:06:48 EDT 2016


On 10/04/2016 05:46 PM, Stephen Kelly wrote:
> This causes problems because now the code has to read the value for each 
> directory and can't assume that the value is always the same as the value 
> from the top-level CMakeLists file.

Many of these are honored only in the top-level directory anyway.
Such cases could have documentation updated.

Some of them may be per-`project()`.

> Is the answer 'Use global properties or a cache variable instead'?

The options need to be something easy for the project to set itself
or for a user to set.  A cache entry can work for that, but we don't
really often read cache entries directly and instead read variables
that fall back to cache entries if not defined.  The scoping doesn't
match the generator semantics exactly, but it is easy to use and
hasn't been a big problem.

-Brad



More information about the cmake-developers mailing list