It means that minimum required version is 3.16.3, and that all the policies introduced before 3.19.7 will be implicitly set to NEW. If you use CMake newer than that, the policies introduced after 3.19.7 will be set to OLD, which is the normal default.
Thanks @dzenanz Nowadays CMake versions newer than 3.19.7 are very common (ITK’s CI uses version 3.25.1, lastest CMake release 3.25.2). Such a new version “behaves like” CMake version 3.19.7, according to our cmake_minimum_required call, right? But then, I guess policies introduced after 3.16.3 still cannot be used (or assumed) in ITK’s CMake code. Because the old CMakes 3.16.3 is still supported. And 3.16.3 cannot have the new policy behavior of 3.19.7.
I still wonder, why not just do:
cmake_minimum_required(VERSION 3.16.3)
As long as we still want to support that old version, including its old behavior regarding the policies. Is there a specific use case for VERSION 3.16.3...3.19.7?
VERSION 3.16.3...3.19.7 is equivalent to cmake_minimum_required(VERSION 3.16.3) + a bunch of policy(NEW), for all policies introduced between 3.16.3 and 3.19.7. The most visible effect of setting those policies to NEW is getting rid of warnings when using CMake version newer than 3.16.3.
And yes, we should bump the minimum CMake version. At least to 3.22.1 (bundled with Ubuntu 22.04 LTS), possibly newer. But that requires a bit of effort, because policies introduced between 3.19.7 and 3.22.1 (or whatever we choose as the new minimum version) need to be checked for their impact on ITK. Currently they are implicitly set to OLD, after we bump minimum version they will be implicitly set to NEW.
I agree with Brad. It is still just a bit pre-mature to require 22.04. My university will not start transitioning to 22.04 until August or December of 2023. Ubuntu 20.04 is just over 1/2 way through it’s 5 year support lifespan.
I think we should first set the upper bound to something beyond 3.22.1 to ensure that there are no new errors that are exposed for the few of us who do use very new cmake versions.
Then, we can consider moving the minimum requirement to something that has been (minimally) tested.
Thanks for all your feedback. So do I understand correctly that the minimum version ( 3.16.3) is a real requirement, whereas the maximum version ( 3.19.7) is just specified to avoid certain CMake warnings?