Qmake: Fix deploying versioned shared library symlinks

If in a .pro file VERSION is set with less than three version
components, for example "1.0", qmake on Linux still creates the .so with
the following links to it:

- libexample.so
- libexample.so.1
- libexample.so.1.0
- libexample.so.1.0.0

Creator only deployed first three of those.

Pad the version number with zeros to three components in order to find
all of them.

Change-Id: I0ca3b7cb9d2150e7e9a5c22a5522678aec085b95
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Kari Oikarinen
2017-04-07 13:12:02 +03:00
parent 83fd207a64
commit 8c86400329

View File

@@ -1214,14 +1214,15 @@ void QmakeProject::collectLibraryData(const QmakeProFile *file, DeploymentData &
QString version = file->singleVariableValue(Variable::Version);
if (version.isEmpty())
version = QLatin1String("1.0.0");
QStringList versionComponents = version.split('.');
while (versionComponents.size() < 3)
versionComponents << QLatin1String("0");
targetFileName += QLatin1Char('.');
while (true) {
while (!versionComponents.isEmpty()) {
const QString versionString = versionComponents.join(QLatin1Char('.'));
deploymentData.addFile(destDirFor(ti).toString() + '/'
+ targetFileName + version, targetPath);
const QString tmpVersion = version.left(version.lastIndexOf(QLatin1Char('.')));
if (tmpVersion == version)
break;
version = tmpVersion;
+ targetFileName + versionString, targetPath);
versionComponents.removeLast();
}
}
}