CMake: Add more unsupported options to allow using any CMake for Qt
Currently we have two options that allow overriding the minimum CMake version required to either build or use Qt: - QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT - QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT These options require specifying an exact CMake version that should be allowed, which is a bit cumbersome. Introduce two new options that allow using any CMake version without specifying the exact version. - QT_FORCE_ANY_CMAKE_VERSION_FOR_BUILDING_QT - QT_FORCE_ANY_CMAKE_VERSION_FOR_USING_QT Also introduce a Qt CI specific check that would allow using any CMake in Qt's CI Coin, to allow decoupling of the minimum CMake version bump from the provisioning of the new minimum CMake version. This check should only be enabled temporarily, and then reverted back once the provisioning is done. The current change has the check disabled, it will be enabled in a follow up change, so it's easier to revert. As usual, using any of these options is not officially supported. Pick-to: 6.8 Task-number: QTBUG-131169 Change-Id: Icc3f51ad457ebf8f4251309be97e72a3ff4cd2e0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
56106d1bd7
commit
df7091d9f4
@ -45,11 +45,19 @@ endfunction()
|
||||
|
||||
# Returns the computed minimum supported CMake version required to /build/ Qt.
|
||||
function(qt_internal_get_computed_min_cmake_version_for_building_qt out_var)
|
||||
qt_internal_force_allow_unsuitable_cmake_version_for_building_qt(allow_any_version)
|
||||
|
||||
# An explicit override for those that take it upon themselves to fix the build system
|
||||
# when using a CMake version lower than the one officially supported.
|
||||
# Also useful for build testing locally with different minimum versions to observe different
|
||||
# policy behaviors.
|
||||
if(QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT)
|
||||
if(allow_any_version)
|
||||
# Just set some low version, the exact value is not really important.
|
||||
set(computed_min_version "3.16")
|
||||
|
||||
# Another explicit override with the same reasoning as above, but with an exact version
|
||||
# provided.
|
||||
elseif(QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT)
|
||||
set(computed_min_version "${QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT}")
|
||||
|
||||
# Set in QtBuildInternalsExtras.cmake, which means it was already computed as part of qtbase
|
||||
@ -153,6 +161,29 @@ function(qt_internal_check_and_warn_about_unsuitable_cmake_version)
|
||||
qt_internal_warn_about_buggy_cmake_versions()
|
||||
endfunction()
|
||||
|
||||
# Sets out_var to either TRUE or FALSE if dependning on whether there was a forceful request to
|
||||
# allow using the current cmake version to build Qt.
|
||||
function(qt_internal_force_allow_unsuitable_cmake_version_for_building_qt out_var)
|
||||
set(allow_any_version FALSE)
|
||||
|
||||
# Temporarily allow any version when building in Qt's CI, so we can decouple the provisioning
|
||||
# of the minimum CMake version from the bump of the minimum CMake version.
|
||||
# The COIN_UNIQUE_JOB_ID env var is set in Qt's CI for both build and test work items.
|
||||
# Current state is that this check is disabled.
|
||||
set(allow_any_version_in_ci FALSE)
|
||||
|
||||
if(allow_any_version_in_ci AND DEFINED ENV{COIN_UNIQUE_JOB_ID})
|
||||
set(allow_any_version TRUE)
|
||||
endif()
|
||||
|
||||
# An explicit opt in, for using any CMake version.
|
||||
if(QT_FORCE_ANY_CMAKE_VERSION_FOR_BUILDING_QT)
|
||||
set(allow_any_version TRUE)
|
||||
endif()
|
||||
|
||||
set(${out_var} "${allow_any_version}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Function to be used in downstream repos (like qtsvg) to require a minimum CMake version and warn
|
||||
# about unsuitable cmake versions.
|
||||
#
|
||||
|
@ -8,8 +8,18 @@ function(__qt_internal_get_supported_min_cmake_version_for_using_qt out_var)
|
||||
endfunction()
|
||||
|
||||
function(__qt_internal_get_computed_min_cmake_version_for_using_qt out_var)
|
||||
__qt_internal_force_allow_unsuitable_cmake_version_for_using_qt(allow_any_version)
|
||||
|
||||
# An explicit override for those that take it upon themselves to fix the build system
|
||||
# when using a CMake version lower than the one officially supported.
|
||||
# Also useful for build testing locally with different minimum versions to observe different
|
||||
# policy behaviors.
|
||||
if(allow_any_version)
|
||||
# Just set some low version, the exact value is not really important.
|
||||
set(computed_min_version "3.16")
|
||||
|
||||
# Allow override when configuring user project.
|
||||
if(QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT)
|
||||
elseif(QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT)
|
||||
set(computed_min_version "${QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT}")
|
||||
|
||||
# Set in QtConfigExtras.cmake.
|
||||
@ -37,6 +47,29 @@ function(__qt_internal_warn_if_min_cmake_version_not_met)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Sets out_var to either TRUE or FALSE if dependning on whether there was a forceful request to
|
||||
# allow using the current cmake version to use Qt in projects.
|
||||
function(__qt_internal_force_allow_unsuitable_cmake_version_for_using_qt out_var)
|
||||
set(allow_any_version FALSE)
|
||||
|
||||
# Temporarily allow any version when using Qt in Qt's CI, so we can decouple the provisioning
|
||||
# of the minimum CMake version from the bump of the minimum CMake version.
|
||||
# The COIN_UNIQUE_JOB_ID env var is set in Qt's CI for both build and test work items.
|
||||
# Current state is that this check is disabled.
|
||||
set(allow_any_version_in_ci FALSE)
|
||||
|
||||
if(allow_any_version_in_ci AND DEFINED ENV{COIN_UNIQUE_JOB_ID})
|
||||
set(allow_any_version TRUE)
|
||||
endif()
|
||||
|
||||
# An explicit opt in, for using any CMake version.
|
||||
if(QT_FORCE_ANY_CMAKE_VERSION_FOR_USING_QT)
|
||||
set(allow_any_version TRUE)
|
||||
endif()
|
||||
|
||||
set(${out_var} "${allow_any_version}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(__qt_internal_require_suitable_cmake_version_for_using_qt)
|
||||
# Skip the public project check if we're building a Qt repo because it's too early to do
|
||||
# it at find_package(Qt6) time.
|
||||
|
Loading…
x
Reference in New Issue
Block a user