compiler.pri: tweak OS X SDK detection when building with Qt 4.

In Xcode 5, the xcrun tool includes a --show-sdk-path parameter
which, as the name implies, can be used to query the system for
a usable OS X SDK path. However, xcrun in Xcode 4 does *not*
include this parameter.

We used this parameter unconditionally, which lead to failures
when using building against Qt 4 when using Xcode 4.

This change modifies the SDK selection code to first attempt to
query for the OS X sdk using the --show-sdk-path parameter. If
that fails, we try to fall back to using a 10.8 SDK living in
a DEVELOPER_DIR found via xcode-select --print-path. If that
doesn't exist either, we warn the user and abort the build.

This should allow people to build Mumble on most systems without
having to resort to manual .pro file editing.
This commit is contained in:
Mikkel Krautz 2014-02-08 12:56:41 +01:00
parent d55d944ebc
commit 90963a1b21

View File

@ -143,7 +143,14 @@ macx {
isEqual(QT_MAJOR_VERSION, 5) {
QMAKE_MAC_SDK = macosx
} else {
QMAKE_MAC_SDK = $$system(xcrun --sdk macosx --show-sdk-path)
QMAKE_MAC_SDK = $$system(xcrun --sdk macosx --show-sdk-path 2>/dev/null)
isEmpty(QMAKE_MAC_SDK) {
QMAKE_MAC_SDK = $$system(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
!exists($$QMAKE_MAC_SDK) {
message("Unable to find usable OS X SDK")
error("Aborting build")
}
}
}
QMAKE_CC = $$system(xcrun -find clang)