setting policies centrally (was: cmCMakePolicyCommand: New PARENT_SCOPE argument)

Brad King brad.king at kitware.com
Mon Aug 17 13:25:01 UTC 2015


On 08/15/2015 03:56 AM, David Faure wrote:
> Thanks for the suggestion, however I can't make it work. Am I doing it wrong?
> 
> +set(CMAKE_POLICY_DEFAULT_CMP0063 NEW PARENT_SCOPE) # don't let cmake >= 3.3 warn about the above

It turns out the implementation of this variable is only handled
at a cmake_minimum_required(VERSION) or cmake_policy(VERSION) call.
That implementation is consistent with the documented use case
for the variable (set by end users in local cache).  Either of
those calls sets the policy "version" level, meaning that any
policy introduced by the named version or earlier gets set to NEW
and all newer policies get left unset.  The policy default variables
are a way to not leave newer policies unset.  Now that I remember
this design, I think it was done this way intentionally so that
setting these variables would not be a back door for setting
policies.

So, I think we are back to asking projects to explicitly allow
an included module to set policies by using NO_POLICY_SCOPE.

-Brad



More information about the Kde-buildsystem mailing list