[cmake-developers] set(CACHE) and the local scope

Ben Boeckel ben.boeckel at kitware.com
Wed Dec 9 17:35:28 EST 2015


Hi,

So some behavior I was unaware of until today came up:

    set(var ON)
    option(var "description" OFF)
    message("var: ${var}")

outputs "OFF" for the first configure and "ON" for subsequent
configures. This is because set(var CACHE) does unset(var) *if* the
cache was touched. This is not done on the second time around since it
is already in the cache.

I think a policy to remove the unset(var) behavior should be added since
the current behavior means that clean builds can be wildly different
than incremental builds.

Related, I have a branch on the stage (update-variable-docs) which
attempts to clarify some darker corners of the set() command and the
*VARIABLES directory properties.

Thoughts on the documentation updates and the policy?

Thanks,

--Ben


More information about the cmake-developers mailing list