Fix qmake evaluation of QMAKE_TARGET.arch on msvc2010 x86_64
authorGiotis Nikos <giotis.nikos@gmail.com>
Mon, 6 Feb 2012 23:32:44 +0000 (01:32 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 8 Feb 2012 06:48:43 +0000 (07:48 +0100)
This change is needed because msvc2010 tools have a '\' character at
the end of environment variable VCINSTALLDIR. This variable on msvc2008
does not have this '\' character at its end. Without this change
QMAKE_TARGET.arch on msvc2010 x64 evaluates to x86 instead of x86_64.

Task-number: QTBUG-22686

Change-Id: Ifba833e9361c97568b8b3de9976023e8537b208a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
qmake/project.cpp

index d898483..fbeb033 100644 (file)
@@ -3165,8 +3165,14 @@ QStringList &QMakeProject::values(const QString &_var, QHash<QString, QStringLis
             QString ret, type = var.mid(13);
             if(type == "arch") {
                 QString paths = qgetenv("PATH");
-                QString vcBin64 = qgetenv("VCINSTALLDIR").append("\\bin\\amd64");
-                QString vcBinX86_64 = qgetenv("VCINSTALLDIR").append("\\bin\\x86_amd64");
+                QString vcBin64 = qgetenv("VCINSTALLDIR");
+                if (!vcBin64.endsWith('\\'))
+                    vcBin64.append('\\');
+                vcBin64.append("bin\\amd64");
+                QString vcBinX86_64 = qgetenv("VCINSTALLDIR");
+                if (!vcBinX86_64.endsWith('\\'))
+                    vcBinX86_64.append('\\');
+                vcBinX86_64.append("bin\\x86_amd64");
                 if(paths.contains(vcBin64,Qt::CaseInsensitive) || paths.contains(vcBinX86_64,Qt::CaseInsensitive))
                     ret = "x86_64";
                 else