From e58ff77bd396af02ddd38fcac82ac3eb6eeb8e8b Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Mon, 7 Sep 2009 18:58:04 +0200
Subject: [PATCH] Take the build environment into account for searching what to
 execute.

Fixes a bug where the cmake plugin wasn't finding make, if the make
commands directory was added to path in the build environment.
---
 src/plugins/cmakeprojectmanager/cmakeproject.cpp    | 2 +-
 src/plugins/projectexplorer/abstractprocessstep.cpp | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index e05614029c3..455c6e87095 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -500,7 +500,7 @@ void CMakeProject::setUserEnvironmentChanges(const QString &buildConfig, const Q
     QStringList list = EnvironmentItem::toStringList(diff);
     if (list == value(buildConfig, "userEnvironmentChanges"))
         return;
-    setValue(buildConfig, "userEnvironmentChanges", EnvironmentItem::toStringList(diff));
+    setValue(buildConfig, "userEnvironmentChanges", list);
     emit environmentChanged(buildConfig);
 }
 
diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp
index a766a1e5a8b..e3b7757881e 100644
--- a/src/plugins/projectexplorer/abstractprocessstep.cpp
+++ b/src/plugins/projectexplorer/abstractprocessstep.cpp
@@ -58,7 +58,13 @@ void AbstractProcessStep::setCommand(const QString &buildConfiguration, const QS
 
 QString AbstractProcessStep::command(const QString &buildConfiguration) const
 {
-    return value(buildConfiguration, PROCESS_COMMAND).toString();
+    QString result = value(buildConfiguration, PROCESS_COMMAND).toString();
+    if (QFileInfo(result).isRelative()) {
+        QString searchInPath = environment(buildConfiguration).searchInPath(result);
+        if (!searchInPath.isEmpty())
+            result = searchInPath;
+    }
+    return result;
 }
 
 void AbstractProcessStep::setWorkingDirectory(const QString &buildConfiguration, const QString &workingDirectory)
-- 
GitLab