[cmake-developers] A policy for Policies

Domen Vrankar domen.vrankar at gmail.com
Wed Jun 10 01:41:37 EDT 2015


> A better Policy lifecycle would be
>
> 1) Three releases after introducing a Policy, we make OLD the same as WARN
>    for it. That is, the only way to not get the warning will be to fix the
>    code or use -Wno-dev.
> 2) After some time in years (depending on the impact of the Policy), we
>    change it to an unconditional error.
> 3) Remove the code implementing the OLD behavior in a following release.

+1

> That is because currently Policies *are* feature switches. The answer to
> that is not more warnings, as Alex told us, but error conditions. There
> needs to be credibility to any documentation claiming that setting a Policy
> to OLD will result in an error some day. Such documentatation will be
> ignored.

I've personally never seen them as feature switches but I agree that
they can be too quickly seen as such.

> I've pushed a branch for testing which updates the policies <= CMP0011 to
> REQUIRED_IF_USED. Those have resulted in warnings by default for 6 years.
> That is a long time to ignore warnings.

So that's why my newly added test broke with CMP0011 error :) I didn't
even know that I was using this policy with old functionality... Can I
somehow force treating of all policies as errors to spot such cases
for e.g. in tests?

Side question:
Should cmake_minimum_required also be used in CMake scripts (added
with -P argument to CMake command) not just CMakeLists.txt?
And do we really still need version 2.6 as default (we could bump this
version to where current policies are still treated as warnings not
errors)?
I'd also be glad if missing cmake_minimum_required in root CMake
list/script would be treated as error and not as warning since you can
get old policies in by accident.

Regards,
Domen


More information about the cmake-developers mailing list