MSVC: Report failures to retrieve environment for MSVC

Report failures to retrieve the environment of MSVC compilers as
a build issue. This is way more visible than the qWarning() that
used to be the only indication that something went wrong.

Change-Id: I8b923c3e65e7df14f677e8519b08f5b2218c16a8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Tobias Hunger
2016-12-15 11:39:27 +01:00
parent be705a3ea1
commit 347db259f8

View File

@@ -26,9 +26,9 @@
#include "abstractmsvctoolchain.h"
#include "msvcparser.h"
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorersettings.h>
#include "projectexplorer.h"
#include "projectexplorersettings.h"
#include "taskhub.h"
#include <utils/qtcprocess.h>
#include <utils/synchronousprocess.h>
@@ -301,7 +301,16 @@ bool AbstractMsvcToolChain::generateEnvironmentSettings(Utils::Environment &env,
run.setCodec(QTextCodec::codecForName("UTF-8"));
Utils::SynchronousProcessResponse response = run.runBlocking(cmdPath.toString(), cmdArguments);
if (response.result != Utils::SynchronousProcessResponse::Finished) {
qWarning() << response.exitMessage(cmdPath.toString(), 10);
const QString message = response.exitMessage(cmdPath.toString(), 10);
qWarning().noquote() << message;
QString command = QDir::toNativeSeparators(batchFile);
if (!batchArgs.isEmpty())
command += ' ' + batchArgs;
TaskHub::addTask(Task::Error,
QCoreApplication::translate("ProjectExplorer::Internal::AbstractMsvcToolChain",
"Failed to retrieve MSVC Environment from \"%1\":\n"
"%2")
.arg(command, message), Constants::TASK_CATEGORY_COMPILE);
return false;
}