cmake_minimum_required ITK_NEWEST_VALIDATED_POLICIES_VERSION 3.19.7?

ITK’s root CMakeLists starts with cmake_minimum_required(VERSION 3.16.3...3.19.7), or more precisely:

Using the VERSION <min>...<max> parameters, as documented at

Does that mean that we should preferably use CMake <= 3.19.7 (at most 3.19.7) to configure and generate an ITK build tree?

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.

1 Like

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.

@hjmjohnson @blowekamp @jhlegarreta @matt.mccormick what do you think?

CMake 3.16.3 is the version that comes with Ubuntu 20.04 LTS. Ubuntu 22.04 LTS, released April 2022, comes with CMake 3.22.1-1

I know I have builds running Ubuntu 20.04 and the system CMake. I think Ubuntu 20.04 is still widely in used.

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.


1 Like

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.

1 Like

+1 for keeping the minimum to 3.16 for Ubuntu 20.04 support and also bumping the maximum supported version.

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?


1 Like