[cmake-developers] A policy for Policies

Alex Merry alex.merry at kde.org
Sat Jun 6 09:51:49 EDT 2015


On Saturday 06 June 2015 12:36:53 Stephen Kelly wrote:
> Hi,
> 
> The documentation notes that Policies are not feature toggles:
> 
>  http://www.cmake.org/cmake/help/git-master/manual/cmake-policies.7.html
> 
> However, the reality is that Policies *are* feature toggles because they are
> so long-lived. Users have no expectation that Policies will 'stop working',
> and happily set them to OLD and encourage others to do the same. I see this
> on StackOverflow all the time, and on the users mailing list.
> 
> Code for Policies is also often complex. I often encounter Policies which
> are ancient and which get in the way of code clean up generally.
> 
> We also encountered this with CMP0024 and CMP0026 getting in the way in
> 2013. The refactoring I'm doing now will encounter those two again. I'd also
> prefer to drop CMP0011 rather than deal with its complexity in my current
> refactoring. CMP0011 was introduced in 2009.
> 
> 
> I propose a policy that a Policy may be changed to REQUIRED_IF_USED in a
> release two years following the release which introduced it. Such a change
> will then result in an error if code attempts to set it to OLD, and
> recommend the user to use an older release or fix the code instead.

I'm not sure the term REQUIRED_IF_USED is clear enough - I'm certainly 
confused by quite what you mean by it.

The main reason for keeping policies around, as I see it, is to allow old 
projects to keep building with newer versions of CMake. The main questions 
are: how far back do we want this compatibility to go? and how selective do we 
want to allow developers to be about policies?

However much we care about backwards compatilibity, I think it's reasonable to 
have a cut-off point for allowing setting individual policies back (as opposed 
to having them set back by cmake_minimum_required). That would hopefully 
encourage developers to clean up code that depends on old behaviour in order 
to use a useful new feature, which would in turn allow support for old 
policies to be dropped sooner.

Alex


More information about the cmake-developers mailing list