From 77126dc4b8bcd462daa2642aac1565521fbcbe5a Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 10 Dec 2019 16:32:18 +0100 Subject: [PATCH] QmakeProjectManager: Extend Qt examples deployment hack E.g. for Qnx, QT_INSTALL_PREFIX is not a prefix of QT_INSTALL_EXAMPLES. Fixes: QTCREATORBUG-22592 Change-Id: I3092cd76af01519783e1162ab8e79caaf0836f00 Reviewed-by: hjk --- .../qmakeprojectmanager/qmakeparsernodes.cpp | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp index fc3be830c71..16410724b9e 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp @@ -1951,11 +1951,12 @@ InstallsList QmakeProFile::installsList(const QtSupport::ProFileReader *reader, if (itemList.isEmpty()) return result; - const QString installPrefix - = reader->propertyValue(QLatin1String("QT_INSTALL_PREFIX")); - const QString devInstallPrefix - = reader->propertyValue(QLatin1String("QT_INSTALL_PREFIX/dev")); - bool fixInstallPrefix = (installPrefix != devInstallPrefix); + const QStringList installPrefixVars{"QT_INSTALL_PREFIX", "QT_INSTALL_EXAMPLES"}; + QList> installPrefixValues; + for (const QString &installPrefix : installPrefixVars) { + installPrefixValues << qMakePair(reader->propertyValue(installPrefix), + reader->propertyValue(installPrefix + "/dev")); + } foreach (const QString &item, itemList) { const QStringList config = reader->values(item + ".CONFIG"); @@ -1974,13 +1975,18 @@ InstallsList QmakeProFile::installsList(const QtSupport::ProFileReader *reader, } QString itemPath = itemPaths.last(); - if (fixInstallPrefix && itemPath.startsWith(installPrefix)) { + for (const auto &prefixValuePair : qAsConst(installPrefixValues)) { + if (prefixValuePair.first == prefixValuePair.second + || !itemPath.startsWith(prefixValuePair.first)) { + continue; + } // This is a hack for projects which install into $$[QT_INSTALL_*], // in particular Qt itself, examples being most relevant. // Projects which implement their own install path policy must // parametrize their INSTALLS themselves depending on the intended // installation/deployment mode. - itemPath.replace(0, installPrefix.length(), devInstallPrefix); + itemPath.replace(0, prefixValuePair.first.length(), prefixValuePair.second); + break; } if (item == QLatin1String("target")) { if (active)