aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/qbs-setup-qt
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-04-28 16:18:44 +0200
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-05-11 14:20:43 +0000
commit2f507d112c8563297b51e9f6bfb2101044f27d95 (patch)
treeccb69a4427c4b415cdef4500dfe52809aaa72d93 /src/app/qbs-setup-qt
parent34f9324d1ba87e6ad2115abf3981180cd691fd83 (diff)
let setup-qt detect qmake-qt4 and qmake-qt5 executables
Some Linux distributions provide qmake binaries that are called qmake-qt4 and qmake-qt5. Let setup-qt find those in auto-detection mode. Change-Id: Iaf3ac087ab05201a4d2823629236b46167e6e1c1 Task-number: QBS-745 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'src/app/qbs-setup-qt')
-rw-r--r--src/app/qbs-setup-qt/setupqt.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp
index afc1a7f8b..141180b6a 100644
--- a/src/app/qbs-setup-qt/setupqt.cpp
+++ b/src/app/qbs-setup-qt/setupqt.cpp
@@ -55,21 +55,32 @@ using Internal::HostOsInfo;
using Internal::Tr;
using Internal::Version;
-const QString qmakeExecutableName = QLatin1String("qmake" QBS_HOST_EXE_SUFFIX);
+static QStringList qmakeExecutableNames()
+{
+ const QString baseName = HostOsInfo::appendExecutableSuffix(QStringLiteral("qmake"));
+ QStringList lst(baseName);
+ if (HostOsInfo::isLinuxHost()) {
+ // Some distributions ship binaries called qmake-qt5 or qmake-qt4.
+ lst << baseName + QLatin1String("-qt5") << baseName + QLatin1String("-qt4");
+ }
+ return lst;
+}
static QStringList collectQmakePaths()
{
+ const QStringList qmakeExeNames = qmakeExecutableNames();
QStringList qmakePaths;
-
QByteArray environmentPath = qgetenv("PATH");
QList<QByteArray> environmentPaths
= environmentPath.split(HostOsInfo::pathListSeparator().toLatin1());
foreach (const QByteArray &path, environmentPaths) {
- QFileInfo pathFileInfo(QDir(QLatin1String(path)), qmakeExecutableName);
- if (pathFileInfo.exists()) {
- QString qmakePath = pathFileInfo.absoluteFilePath();
- if (!qmakePaths.contains(qmakePath))
- qmakePaths.append(qmakePath);
+ foreach (const QString &qmakeExecutableName, qmakeExeNames) {
+ QFileInfo pathFileInfo(QDir(QLatin1String(path)), qmakeExecutableName);
+ if (pathFileInfo.exists()) {
+ QString qmakePath = pathFileInfo.absoluteFilePath();
+ if (!qmakePaths.contains(qmakePath))
+ qmakePaths.append(qmakePath);
+ }
}
}