[cmake-developers] CMake policies (was: User vs CMake include mismatch handling)

Brad King brad.king at kitware.com
Fri Nov 19 07:41:46 EST 2010


On 11/19/2010 03:56 AM, Marcel Loose wrote:
> Slightly off-topic: I couldn't find any references to this information
> in the CMake manual.

That link was a design document.  The actual interface is documented:

  http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:cmake_policy
  http://www.cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies

> It would also be nice if you could easily check
> which policies are set (and to which value) for a given project.

The settings are not project-wide.  They are scoped.  At any one point
one can add code using cmake_policy(GET) to check a value.

Policy CMP0000 requires projects to start with a

 cmake_minimum_required(VERSION ...)

and that command sets all policies introduced in the given version
and earlier to NEW.  The policies of interest in a project are
those introduced between the minimum version and the currently
running CMake.  Of course subdirectories and include()-ed files
can have their own calls to cmake_minimum_required with different
values, and the cmake_policy(SET) command may be used in specific
scopes also.

-Brad



More information about the cmake-developers mailing list