[CMake] cmake policy setting

Bill Hoffman bill.hoffman at kitware.com
Fri Oct 29 10:16:32 EDT 2010


On 10/29/2010 6:33 AM, Marco Atzeri wrote:
> As there is no example in the documentaion,
> could someone clarify me if the change of any policy
> that should require an additional
>
> cmake_policy(SET CMP<NNNN>  NEW)
>
>
> could also be requested at cmake invocation with
> ---------------------------------------------------
> # -D<var>:<type>=<value>: Create a cmake cache entry.
>
> When cmake is first run in an empty build tree, it creates a CMakeCache.txt file and populates it with customizable settings for the project. This option may be used to specify a setting that takes priority over the project's default value. The option may be repeated for as many cache entries as desired.
> ---------------------------------------------------
>

There is no way to change a policy from the cache.  That is not really 
how policies are supposed to work.  It is for the developer of the 
CmakeLists.txt files to set the policies as they see fit.  The -D 
options are user options.   In most cases, moving to a NEW policy will 
require changes to the CMakeLists.txt files so doing it from the command 
line would not make sense.

Here is the documentation for polices:
http://www.cmake.org/Wiki/CMake_Policies


-Bill


More information about the CMake mailing list