[cmake-developers] policies in CMake builtin modules (was: FindCUDA: Wrap keyword in if() string comparison)

Brad King brad.king at kitware.com
Thu Sep 18 10:05:39 EDT 2014


On 09/17/2014 02:25 PM, Nils Gladitz wrote:
> I pushed "root-modules-set-policies-new" to stage which sets all 
> policies to NEW for modules from cmake's own Modules directory if 
> NO_POLICY_SCOPE is not used.

A minor comment on the impl: use cmSystemTools::GetCMakeRoot
instead of looking up CMAKE_ROOT.

However, I do not think this approach will work well in general.
We do not have extensive testing covering all functionality of
the builtin modules.  We do not actually know that all the
modules will work with every policy set to NEW right away.
Typically authors of projects that use the modules will report
bugs if things break when the projects set policies to NEW.
Meanwhile at least existing projects keep building with the
OLD policy behavior.

Modules on an individual basis could use cmake_policy(PUSH/POP)
and cmake_policy(SET) to get NEW behavior for specific policies
that they trigger.

-Brad




More information about the cmake-developers mailing list