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>
This commit is contained in:
parent
566399937b
commit
4a2b9e086e
@ -853,8 +853,15 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
|
QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
|
||||||
suffixSetting = "$(" + suffixSetting + ")";
|
suffixSetting = "$(" + suffixSetting + ")";
|
||||||
if (!librarySuffix.isEmpty()) {
|
if (!librarySuffix.isEmpty()) {
|
||||||
library.replace(librarySuffix, suffixSetting);
|
int pos = library.lastIndexOf(librarySuffix + '.');
|
||||||
name.remove(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 {
|
} else {
|
||||||
library.replace(name, name + suffixSetting);
|
library.replace(name, name + suffixSetting);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user