CMake: Fix Apple max sdk version check

We need to warn only when using a major version that is the next one
after the 'max supported version'.

Add an assertion that the max sdk version specified in .cmake.conf
needs to be just the major sdk version, without a minor or patch
version component, otherwise the '+1' math expression will fail.

Pick-to: 6.6
Task-number: QTBUG-119490
Change-Id: Ib30abe7157c2ccbe0ad7a98e81fc241685a141a8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2023-12-04 16:34:46 +01:00
parent 248f8bff16
commit a0bdd2195f

View File

@ -809,6 +809,12 @@ function(_qt_internal_check_apple_sdk_and_xcode_versions)
_qt_internal_get_cached_apple_sdk_version(sdk_version)
_qt_internal_get_cached_xcode_version(xcode_version)
if(NOT max_sdk_version MATCHES "^[0-9]+$")
message(FATAL_ERROR
"Invalid max SDK version: ${max_sdk_version} "
"It should be a major version number, without minor or patch version components.")
endif()
# The default differs in different branches.
set(failed_check_should_error FALSE)
@ -857,9 +863,9 @@ function(_qt_internal_check_apple_sdk_and_xcode_versions)
return()
endif()
# Upper bound checks should always be warnings, because the build might still work even
# if untested.
if(sdk_version VERSION_GREATER_EQUAL max_sdk_version)
# Make sure we warn only when the current version is greater than the max supported version.
math(EXPR next_after_max_sdk_version "${max_sdk_version} + 1")
if(sdk_version VERSION_GREATER_EQUAL next_after_max_sdk_version)
message(WARNING
"Qt has only been tested with version ${max_sdk_version} "
"of the platform SDK, you're using ${sdk_version}. "