summaryrefslogtreecommitdiffstats
path: root/qmake/generators/mac
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2015-10-28 13:19:59 +0100
committerRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2015-11-09 08:35:04 +0000
commit4a2b9e086eb3d16403620b31a4d05bef529910d3 (patch)
tree11b14d09500dcfb2575cd2c21b784d54e798a22d /qmake/generators/mac
parent566399937ba3d17df12aa0cd8e7fe79bb0005b16 (diff)
Xcode generator: only replace the suffix in the library path
The Xcode generator iterates trought all libraries and replaces their suffix (e.g "_debug") with a placeholder that lets Xcode switch between different library versions depending on the target. The current way we do this fails when the name of a library happens to contain the string "_debug" (e.g "qmldbg_debugger"). Since we replace every occurrence of suffix in the path, we end up replacing that part as well. The result will be linking errors. This patch ensures that we only replace the last occurrence of the suffix in the file path. Task-number: QTBUG-48961 Change-Id: I9fafbe0ea0ad8b9cfd13448d6b28801106e645ec Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'qmake/generators/mac')
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index ccb3cfe810..42dd6c8aeb 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -853,8 +853,15 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
suffixSetting = "$(" + suffixSetting + ")";
if (!librarySuffix.isEmpty()) {
- library.replace(librarySuffix, suffixSetting);
- name.remove(librarySuffix);
+ int pos = library.lastIndexOf(librarySuffix + '.');
+ if (pos == -1) {
+ warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.",
+ qPrintable(librarySuffix), qPrintable(library));
+ } else {
+ library.replace(pos, librarySuffix.length(), suffixSetting);
+ if (name.endsWith(librarySuffix))
+ name.chop(librarySuffix.length());
+ }
} else {
library.replace(name, name + suffixSetting);
}