[CMake] Adding Cmake version in online documentation

Albrecht Schlosser AlbrechtS.fltk at online.de
Tue Nov 8 14:26:23 EST 2016


On 08.11.2016 15:22 Nils Gladitz wrote:
> On 11/08/2016 03:11 PM, Dvir Yitzchaki wrote:
>
>> But how do you know which version to declare on cmake_minimum_required?
>> If this feature will be added it won't be far from writing a script
>> that scans the commands you use and outputs the first appropriate
>> version.

I'd also like such an addition to the documentation for reasons 
discussed below.

> Strictly speaking cmake_minimum_required(VERSION) is not about command
> availability but rather about behavior (cmake policies).
[...]
> I'd start by requesting the highest possible version I could justify
> (e.g. based on availability on target platforms and user convenience)
> and then start from there.

And that's exactly the (my) point. How can I find out the "highest 
possible version I could justify"?

I'm a developer of a public GUI library (FLTK). In this position you 
don't know anything about the availability of CMake versions on your 
target platforms. Our intention is to keep cmake_minimum_required() as 
low as possible.

That said, whenever you change a CMakeLists.txt file you should be aware 
if the commands you use are compatible with the CMake version you 
"require". There should be an easy way to find out in which version a 
particular CMake command has been introduced. Only with this information 
you can decide if you should use this fine command or better find 
another way to do the task you're going to do.

I'd like to have a list of release dates (I'm not sure if there is one) 
as well as the exact version a feature was introduced to write 
CMakeLists.txt files that run on really old CMake versions.

Note: currently we have cmake_minimum_required(VERSION 2.6.3) (sic!), 
but we also have conditional code for some higher CMake versions:

if(CMAKE_VERSION VERSION_GREATER 2.8.4) ...
if(NOT CMAKE_VERSION VERSION_LESS 3.0.0) ...

I'd appreciate such additions very much to be able to write more 
portable CMake files. TIA.



More information about the CMake mailing list