summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/mac/default_pre.prf
blob: c0314039305c0a36fd05d693a8f8d045be238256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
CONFIG = sdk rez $$CONFIG
load(default_pre)

isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
    # Get path of Xcode's Developer directory
    QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
    isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
        error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")

    # Make sure Xcode path is valid
    !exists($$QMAKE_XCODE_DEVELOPER_PATH): \
        error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")

    # Make sure Xcode is set up properly
    isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \
        error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
}

isEmpty(QMAKE_XCODE_VERSION) {
    # Extract Xcode version using xcodebuild
    xcode_version = $$system("/usr/bin/xcodebuild -version")
    QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
    isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
    unset(xcode_version)
}

isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
    QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
    exists($$QMAKE_XCODE_PREFERENCES_FILE): \
        QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")

    !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
        cache(QMAKE_TARGET_BUNDLE_PREFIX)
}

# This variable is used by the xcode_dynamic_library_suffix
# feature, which allows Xcode to choose the Qt libraries to link to
# at build time, depending on the current Xcode SDK and configuration.
QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX