summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2023-12-04 16:34:46 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-12-05 16:28:32 +0000
commitc98a4863ddb45ef2f2e7f63a2d0191d57833e510 (patch)
tree50f6dfbefd1fe6a86a52a2324084e75aab48059b /cmake
parent68b0fca6eb87f0b32f92122f37e31b0ff488592b (diff)
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. Task-number: QTBUG-119490 Change-Id: Ib30abe7157c2ccbe0ad7a98e81fc241685a141a8 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit a0bdd2195f24d8a7d880ba506afc16b41337218e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtPublicAppleHelpers.cmake12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmake/QtPublicAppleHelpers.cmake b/cmake/QtPublicAppleHelpers.cmake
index 2d807ef830..434461c796 100644
--- a/cmake/QtPublicAppleHelpers.cmake
+++ b/cmake/QtPublicAppleHelpers.cmake
@@ -812,6 +812,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)
@@ -860,9 +866,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}. "