summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/features/mac/default_pre.prf6
-rw-r--r--mkspecs/features/resolve_config.prf37
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp14
3 files changed, 50 insertions, 7 deletions
diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
index e535c4d9e9..c0596d5ef0 100644
--- a/mkspecs/features/mac/default_pre.prf
+++ b/mkspecs/features/mac/default_pre.prf
@@ -23,3 +23,9 @@ isEmpty(QMAKE_XCODE_VERSION) {
isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
unset(xcode_version)
}
+
+# These two variables are 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 = $$qtPlatformTargetSuffix()
+QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
diff --git a/mkspecs/features/resolve_config.prf b/mkspecs/features/resolve_config.prf
index 41e82b2382..3884598a94 100644
--- a/mkspecs/features/resolve_config.prf
+++ b/mkspecs/features/resolve_config.prf
@@ -36,11 +36,34 @@ CONFIG(debug, debug|release): \
else: \
CONFIG -= debug
-debug_and_release {
- !macx-xcode: addExclusiveBuilds(debug, Debug, release, Release)
-} else: fix_output_dirs {
- debug: \
- fixExclusiveOutputDirs(debug, release)
- else: \
- fixExclusiveOutputDirs(release, debug)
+!macx-xcode {
+ debug_and_release {
+ addExclusiveBuilds(debug, Debug, release, Release)
+ } else: fix_output_dirs {
+ debug: \
+ fixExclusiveOutputDirs(debug, release)
+ else: \
+ fixExclusiveOutputDirs(release, debug)
+ }
+} else {
+ # The Xcode generator always generates project files with
+ # debug and release configurations, regardless of whether
+ # or not debug_and_release is active.
+ for(build, $$list(debug release)) {
+ suffix =
+ contains(QT_CONFIG, debug_and_release) {
+ equals(build, debug): \
+ suffix = _debug
+ } else {
+ contains(QT_CONFIG, debug): \
+ suffix = _debug
+ }
+
+ library_suffix_$${build}.name = $$QMAKE_XCODE_LIBRARY_SUFFIX_SETTING
+ library_suffix_$${build}.value = $$suffix
+ library_suffix_$${build}.build = $$build
+ QMAKE_MAC_XCODE_SETTINGS += library_suffix_$${build}
+
+ CONFIG *= xcode_dynamic_library_suffix
+ }
}
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index ac9e4cc71a..03887e7938 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -874,6 +874,20 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)",
opt.toLatin1().constData(), lib_file.toLatin1().constData(), library.toLatin1().constData());
remove = true;
+
+ if (project->isActiveConfig("xcode_dynamic_library_suffix")) {
+ QString suffixSetting = project->first("QMAKE_XCODE_LIBRARY_SUFFIX_SETTING").toQString();
+ if (!suffixSetting.isEmpty()) {
+ QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
+ suffixSetting = "$(" + suffixSetting + ")";
+ if (!librarySuffix.isEmpty()) {
+ library = library.replace(librarySuffix, suffixSetting);
+ name = name.remove(librarySuffix);
+ } else {
+ library = library.replace(name, name + suffixSetting);
+ }
+ }
+ }
}
}
}