Rename Qt CMake policies argument names

We decided to go with REQUIRES/SUPPORTS_UP_TO.

Pick-to: 6.5
Task-number: QTBUG-96233
Change-Id: Ia82d22618d31c06b5260a632ba079eeba7a506e0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Amir Masoud Abdol 2023-02-07 13:12:18 +01:00
parent 27db859c6a
commit 04a3e411ec
2 changed files with 18 additions and 18 deletions

View File

@ -2738,8 +2738,8 @@ macro(qt6_standard_project_setup)
set(__qt_sps_args_option)
set(__qt_sps_args_single
MIN_VERSION
MAX_VERSION
REQUIRES
SUPPORTS_UP_TO
)
set(__qt_sps_args_multi)
cmake_parse_arguments(__qt_sps_arg
@ -2764,22 +2764,22 @@ macro(qt6_standard_project_setup)
else()
message(FATAL_ERROR "Can not determine Qt version.")
endif()
if(__qt_sps_arg_MIN_VERSION)
if("${__qt_current_version}" VERSION_LESS "${__qt_sps_arg_MIN_VERSION}")
if(__qt_sps_arg_REQUIRES)
if("${__qt_current_version}" VERSION_LESS "${__qt_sps_arg_REQUIRES}")
message(FATAL_ERROR
"Project required a Qt minimum version of ${__qt_sps_arg_MIN_VERSION}, "
"Project required a Qt minimum version of ${__qt_sps_arg_REQUIRES}, "
"but current version is only ${__qt_current_version}.")
endif()
set(__qt_policy_check_version "${__qt_sps_arg_MIN_VERSION}")
set(__qt_policy_check_version "${__qt_sps_arg_REQUIRES}")
endif()
if(__qt_sps_arg_MAX_VERSION)
if(__qt_sps_arg_MIN_VERSION)
if(${__qt_sps_arg_MAX_VERSION} VERSION_LESS ${__qt_sps_arg_MIN_VERSION})
message(FATAL_ERROR "MAX_VERSION must be larger than or equal to MIN_VERSION.")
if(__qt_sps_arg_SUPPORTS_UP_TO)
if(__qt_sps_arg_REQUIRES)
if(${__qt_sps_arg_SUPPORTS_UP_TO} VERSION_LESS ${__qt_sps_arg_REQUIRES})
message(FATAL_ERROR "SUPPORTS_UP_TO must be larger than or equal to REQUIRES.")
endif()
set(__qt_policy_check_version "${__qt_sps_arg_MAX_VERSION}")
set(__qt_policy_check_version "${__qt_sps_arg_SUPPORTS_UP_TO}")
else()
message(FATAL_ERROR "Please specify the MIN_VERSION as well.")
message(FATAL_ERROR "Please specify the REQUIRES as well.")
endif()
endif()

View File

@ -18,8 +18,8 @@
\badcode
qt_standard_project_setup(
[MIN_VERSION <version>]
[MAX_VERSION <version>]
[REQUIRES <version>]
[SUPPORTS_UP_TO <version>]
)
\endcode
@ -51,11 +51,11 @@ have been defined. It does the following things:
\endlist
Since Qt 6.5, it is possible to change the default behavior of Qt's CMake
API by opting in to changes from newer Qt versions. If \c{MIN_VERSION} is
specified, all suggested changes introduced in Qt up to \c{MIN_VERSION} are enabled,
API by opting in to changes from newer Qt versions. If \c{REQUIRES} is
specified, all suggested changes introduced in Qt up to \c{REQUIRES} are enabled,
and using an older Qt version will result in an error.
If additionally \c{MAX_VERSION} has been specified, any new changes introduced
in versions up to \c{MAX_VERSION} are also enabled (but using an older Qt
If additionally \c{SUPPORTS_UP_TO} has been specified, any new changes introduced
in versions up to \c{SUPPORTS_UP_TO} are also enabled (but using an older Qt
version is not an error). This is similar to CMake's policy concept
(compare \l{cmake_policy}).