[cmake-developers] Could a cmake_maximum_required() work?

Brad King brad.king at kitware.com
Wed Apr 25 14:08:25 EDT 2012


On Wed, Apr 25, 2012 at 1:55 PM, Stephen Kelly <steveire at gmail.com> wrote:
> The idea is that if you use cmake_maximum_required(2.8.8) and attempt to use
> a feature or API introduced in 2.8.9, CMake would report an error.

I don't think that's the opposite of a minimum required version, I
think that *is* one.  The same error could be generated just from

  cmake_minimum_required(VERSION 2.8.8)

because CMake 2.8.9 would know that it is possible users may run 2.8.8
on the project.

Either way it will be very difficult to implement and maintain.  Even
if we taught every feature to check the version projects might do

 if(NOT ${CMAKE_VERSION} VERSION_LESS 2.8.9)
  # use 2.8.9 feature
 endif()

and it would be very hard for CMake code running inside the condition
to detect that it is okay.

Project testing infrastructure (e.g. nightly dashboard builds) should
include runs using the oldest CMake allowed to ensure things work
without newer features.

-Brad



More information about the cmake-developers mailing list