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 "makeinstallstep.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/deployconfiguration.h>
|
#include <projectexplorer/deployconfiguration.h>
|
||||||
#include <projectexplorer/processparameters.h>
|
#include <projectexplorer/processparameters.h>
|
||||||
@@ -141,6 +142,12 @@ bool MakeInstallStep::init()
|
|||||||
env.set(it.key(), it.value());
|
env.set(it.key(), it.value());
|
||||||
processParameters()->setEnvironment(env);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,10 +164,23 @@ void MakeInstallStep::finish(bool success)
|
|||||||
fi.dir().path().mid(installRoot().toString().length()));
|
fi.dir().path().mid(installRoot().toString().length()));
|
||||||
}
|
}
|
||||||
target()->setDeploymentData(m_deploymentData);
|
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);
|
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
|
FileName MakeInstallStep::installRoot() const
|
||||||
{
|
{
|
||||||
return static_cast<BaseStringAspect *>(aspect(InstallRootAspectId))->fileName();
|
return static_cast<BaseStringAspect *>(aspect(InstallRootAspectId))->fileName();
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ private:
|
|||||||
ProjectExplorer::BuildStepConfigWidget * createConfigWidget() override;
|
ProjectExplorer::BuildStepConfigWidget * createConfigWidget() override;
|
||||||
bool init() override;
|
bool init() override;
|
||||||
void finish(bool success) override;
|
void finish(bool success) override;
|
||||||
|
void stdError(const QString &line) override;
|
||||||
|
|
||||||
Utils::FileName installRoot() const;
|
Utils::FileName installRoot() const;
|
||||||
bool cleanInstallRoot() const;
|
bool cleanInstallRoot() const;
|
||||||
@@ -56,6 +57,8 @@ private:
|
|||||||
void updateFullCommandLine();
|
void updateFullCommandLine();
|
||||||
|
|
||||||
ProjectExplorer::DeploymentData m_deploymentData;
|
ProjectExplorer::DeploymentData m_deploymentData;
|
||||||
|
bool m_noInstallTarget = false;
|
||||||
|
bool m_isCmakeProject = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user