[CMake] Policies in generate step

Brad King brad.king at kitware.com
Fri Jan 17 13:09:07 EST 2014


On Fri, Jan 17, 2014 at 11:25 AM, Dominik Bernhardt <dominik.lists at dokabe.de> wrote:
> I'm using the latest master branch on Windows and I have the impression that
> whatever I set for policies, the setting is ignored in the generate step.

Some policies aren't enforced until generate time.  Typically their settings
are recorded on targets using the value in effect as each target is created.
You can use cmake_policy(GET) to check the value just before the add_library
or add_executable call for the target producing the warning.

Note that cmake_minimum_required(VERSION):

 http://www.cmake.org/cmake/help/v2.8.12/cmake.html#command:cmake_minimum_required

will unset policies newer than the specified version number.  If you have not
set a policy explicitly since the most recent call to that then the policy will
not be set when a target is created, and therefore you may get the warning
at generate time.

-Brad


More information about the CMake mailing list