[CMake] Adding Cmake version in online documentation

Nils Gladitz nilsgladitz at gmail.com
Tue Nov 8 10:33:01 EST 2016


On 11/08/2016 04:17 PM, Ruslan Baratov wrote:

> On 08-Nov-16 22:22, Nils Gladitz wrote:
>> Strictly speaking cmake_minimum_required(VERSION) is not about command
>> availability but rather about behavior (cmake policies).
> Except it's exactly opposite :) `cmake_minimum_required` is about new
> features/commands, and policies is about behavior.

I don't agree and you can not separate the two.
cmake_minimum_required() initializes the policies based on the given 
version.

>   If you have command
> `if(IN_LIST)` since 3.3 you can't manipulate policies in such way that
> it will work with CMake 2.8. However if you have warning about policy
> CMP0054 (since CMake 3.2) you can set policy to old without changing
> `cmake_minimum_required` (hence without forcing your CMake 2.8 users to
> upgrade to CMake 3.2).

Coincidentally I implemented both of those policies :)

Given your second example you likely shouldn't be touching the policy at 
all.

A policy warning does not force your users to use a new CMake version.
In fact all that setting it to OLD does is suppress the warning.
CMake will use the old behavior in either case.

The warnings guide developers when they do bump their 
cmake_minimum_required(VERSION).
By just suppressing it behavior changes might go unnoticed when the bump 
does happen.

Nils


More information about the CMake mailing list