aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-05-22 15:59:07 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2019-05-24 09:11:10 +0000
commitb7755b18c3656faa5bab042067d476fe70636f9c (patch)
tree51d2ae4e0f6b224c3fb2bdf5ee14b0e02c4056d7
parent6fa474ead8cef352da73d4f02e4fd87971aa233e (diff)
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>
-rw-r--r--src/plugins/remotelinux/makeinstallstep.cpp20
-rw-r--r--src/plugins/remotelinux/makeinstallstep.h3
2 files changed, 23 insertions, 0 deletions
diff --git a/src/plugins/remotelinux/makeinstallstep.cpp b/src/plugins/remotelinux/makeinstallstep.cpp
index 7375de150c..25d4128941 100644
--- a/src/plugins/remotelinux/makeinstallstep.cpp
+++ b/src/plugins/remotelinux/makeinstallstep.cpp
@@ -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();
diff --git a/src/plugins/remotelinux/makeinstallstep.h b/src/plugins/remotelinux/makeinstallstep.h
index e9c4e9e25d..c6a0fd5fff 100644
--- a/src/plugins/remotelinux/makeinstallstep.h
+++ b/src/plugins/remotelinux/makeinstallstep.h
@@ -47,6 +47,7 @@ private:
ProjectExplorer::BuildStepConfigWidget * createConfigWidget() override;
bool init() override;
void finish(bool success) override;
+ void stdError(const QString &line) override;
Utils::FileName installRoot() const;
bool cleanInstallRoot() const;
@@ -56,6 +57,8 @@ private:
void updateFullCommandLine();
ProjectExplorer::DeploymentData m_deploymentData;
+ bool m_noInstallTarget = false;
+ bool m_isCmakeProject = false;
};
} // namespace Internal