configure.exe: Detect MSVC version with environment variable CL cleared

The variable may contain the option /nologo, suppressing the output.

Change-Id: I63eedde10aa7264cf56807a0844cadf6293a1d8c
Task-number: QTBUG-56388
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
bb10
Friedemann Kleint 2016-10-10 13:57:33 +02:00
parent adbafab4ef
commit b884fc00f4
1 changed files with 1 additions and 0 deletions

View File

@ -176,6 +176,7 @@ QString Environment::msvcVersion()
const QString command = QFile::decodeName(qgetenv("ComSpec"))
+ QLatin1String(" /c ") + QLatin1String(compilerInfo(CC_MSVC2015)->executable)
+ QLatin1String(" /? 2>&1");
SetEnvironmentVariable(L"CL", NULL); // May contain /nologo, which suppresses the version.
QString version = execute(command, &returnValue);
if (returnValue != 0) {
cout << "Could not get cl version" << returnValue << qPrintable(version) << '\n';;