QtVersion: Special treatment for qthooser

Resolve which qmake qtchooser will forward too, as that qmake will put
it's path into the makefile.

Task-number: QTCREATORBUG-9841
Change-Id: Ib7a17c7683550ce3bb9172c7428a0efc328652f5
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Daniel Teske
2013-08-05 13:03:43 +02:00
parent e61c797c6d
commit 84b479225e
3 changed files with 38 additions and 1 deletions

View File

@@ -37,6 +37,32 @@
namespace Utils {
bool BuildableHelperLibrary::isQtChooser(const QFileInfo &info)
{
return info.isSymLink() && info.symLinkTarget().endsWith(QLatin1String("/qtchooser"));
}
QString BuildableHelperLibrary::qtChooserToQmakePath(const QString &path)
{
QProcess proc;
proc.start(path, QStringList(QLatin1String("-print-env")));
if (!proc.waitForStarted(1000))
return QString();
if (!proc.waitForFinished(1000))
return QString();
QByteArray output = proc.readAllStandardOutput();
int pos = output.indexOf("QTTOOLDIR=");
if (pos == -1)
return QString();
pos += strlen("QTTOOLDIR=\"");
int end = output.indexOf('\"', pos);
if (end == -1)
return QString();
QString result = QString::fromLocal8Bit(output.mid(pos, end - pos)) + QLatin1String("/qmake");
return result;
}
Utils::FileName BuildableHelperLibrary::findSystemQt(const Utils::Environment &env)
{
QStringList paths = env.path();
@@ -45,8 +71,11 @@ Utils::FileName BuildableHelperLibrary::findSystemQt(const Utils::Environment &e
if (!prefix.endsWith(QLatin1Char('/')))
prefix.append(QLatin1Char('/'));
foreach (const QString &possibleCommand, possibleQMakeCommands()) {
const QFileInfo qmake(prefix + possibleCommand);
QFileInfo qmake(prefix + possibleCommand);
if (qmake.exists()) {
if (isQtChooser(qmake))
qmake.setFile(qtChooserToQmakePath(qmake.symLinkTarget()));
if (!qtVersionForQMake(qmake.absoluteFilePath()).isNull())
return Utils::FileName(qmake);
}