Skip to content

Commit 9bc7fd3

Browse files
committed
Fix Xcode version check to work with major versions >= 10
We used lessThan for the Xcode version check, which started to fail when comparing Xcode 10 with Xcode 7.3, because lessThan first tries to convert the arguments to ints and if that fails, it does string comparison instead. Rewrite the code to be similar to the SDK checks. We can't use the qmake versionAtLeast function because it was added in Qt 5.10, and we still need to be able to build against Qt 5.9. Task-number: QTBUG-69476 Change-Id: I831a683ee676838a4d531a4d6e715182e9e4193d Reviewed-by: Michael Brüning <[email protected]> (cherry picked from commit 0fc07d2) Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent e344306 commit 9bc7fd3

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

mkspecs/features/functions.prf

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ defineTest(isPlatformSupported) {
3838
return(false)
3939
}
4040
} else:osx {
41-
lessThan(QMAKE_XCODE_VERSION, 5.1) {
41+
!isMinXcodeVersion(5, 1) {
4242
skipBuild("Using XCode version $$QMAKE_XCODE_VERSION, but at least version 5.1 is required to build Qt WebEngine.")
4343
return(false)
4444
}
@@ -241,6 +241,26 @@ defineTest(isMinOSXSDKVersion) {
241241
return(false)
242242
}
243243

244+
defineTest(isMinXcodeVersion) {
245+
requested_major = $$1
246+
requested_minor = $$2
247+
requested_patch = $$3
248+
isEmpty(requested_minor): requested_minor = 0
249+
isEmpty(requested_patch): requested_patch = 0
250+
target_var = QMAKE_XCODE_VERSION
251+
major_version = $$section($$target_var, ., 0, 0)
252+
minor_version = $$section($$target_var, ., 1, 1)
253+
patch_version = $$section($$target_var, ., 2, 2)
254+
isEmpty(minor_version): minor_version = 0
255+
isEmpty(patch_version): patch_version = 0
256+
257+
greaterThan(major_version, $$requested_major):return(true)
258+
equals(major_version, $$requested_major):greaterThan(minor_version, $$requested_minor):return(true)
259+
equals(major_version, $$requested_major):equals(minor_version, $$requested_minor):!lessThan(patch_version, $$requested_patch):return(true)
260+
261+
return(false)
262+
}
263+
244264
defineTest(isMinWinSDKVersion) {
245265
requested_major = $$1
246266
requested_minor = $$2

0 commit comments

Comments
 (0)