Introduce a CMAKE_FIRST_MINIMUM_REQUIRED_VERSION variable
As opposed to https://cmake.org/cmake/help/latest/variable/CMAKE_MINIMUM_REQUIRED_VERSION.html
it would contain the <min>
version of CMake given to the first call of the cmake_minimum_required(VERSION)
command in a project.
The use case is checking that value in a FooConfig.cmake file to error out if the package does not support being used with such a minimum version.
In Qt we need it to ensure that AUTOMOC
related policies are set to NEW, which we can't query for at find_package
time, because the policies might be set after the find_package
call.
We could mandate a minimum CMake version to be specified in the project if we had access to the proposed variable.
For more details you can check the commit message of https://codereview.qt-project.org/c/qt/qtbase/+/372114 and why CMAKE_MINIMUM_REQUIRED_VERSION is not usable for that purpose at https://codereview.qt-project.org/c/qt/qtbase/+/374918