forked from qt-creator/qt-creator
RemoteLinux: Add explanatory message on MakeInstallStep failure
... for the case of a cmake project without an install target. Change-Id: I599a10bc0683706dc7ced1e46e0adcdb9a44d6b7 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "makeinstallstep.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/processparameters.h>
|
||||
@@ -141,6 +142,12 @@ bool MakeInstallStep::init()
|
||||
env.set(it.key(), it.value());
|
||||
processParameters()->setEnvironment(env);
|
||||
}
|
||||
m_noInstallTarget = false;
|
||||
const auto buildStep = buildConfiguration()
|
||||
->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
||||
->firstOfType<AbstractProcessStep>();
|
||||
m_isCmakeProject = buildStep && buildStep->processParameters()->command().toString()
|
||||
.contains("cmake");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -157,10 +164,23 @@ void MakeInstallStep::finish(bool success)
|
||||
fi.dir().path().mid(installRoot().toString().length()));
|
||||
}
|
||||
target()->setDeploymentData(m_deploymentData);
|
||||
} else if (m_noInstallTarget && m_isCmakeProject) {
|
||||
emit addTask(Task(Task::Warning, tr("You need to add an install statement to your "
|
||||
"CMakeLists.txt file for deployment to work."),
|
||||
FileName(), -1, ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT));
|
||||
}
|
||||
MakeStep::finish(success);
|
||||
}
|
||||
|
||||
void MakeInstallStep::stdError(const QString &line)
|
||||
{
|
||||
// When using Makefiles: "No rule to make target 'install'"
|
||||
// When using ninja: "ninja: error: unknown target 'install'"
|
||||
if (line.contains("target 'install'"))
|
||||
m_noInstallTarget = true;
|
||||
MakeStep::stdError(line);
|
||||
}
|
||||
|
||||
FileName MakeInstallStep::installRoot() const
|
||||
{
|
||||
return static_cast<BaseStringAspect *>(aspect(InstallRootAspectId))->fileName();
|
||||
|
||||
Reference in New Issue
Block a user