From 440053f71e52c630ddf2da72d186b5c4f2f0d215 Mon Sep 17 00:00:00 2001
From: dt <qtc-commiter@nokia.com>
Date: Fri, 5 Dec 2008 16:30:26 +0100
Subject: [PATCH] Fixes:    Add the cmakestep and makestep to a
 buildconfigratuion.

Task:     -
RevBy:    -
AutoTest: -
Details:  Actually building only works on unix (since the generator is
hardcoded.) and make is called without any parameters which is wrong.
A lot is missing for basic build support, but this is a start.
---
 .../cmakeprojectmanager/cmakeproject.cpp      | 22 +++++++++++++++++--
 src/plugins/cmakeprojectmanager/cmakestep.cpp |  2 +-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 1268c57b967..fe591fa0041 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -34,6 +34,8 @@
 #include "cmakeproject.h"
 #include "cmakeprojectconstants.h"
 #include "cmakeprojectnodes.h"
+#include "cmakestep.h"
+#include "makestep.h"
 
 #include <extensionsystem/pluginmanager.h>
 #include <cpptools/cppmodelmanagerinterface.h>
@@ -187,7 +189,7 @@ QString CMakeProject::buildDirectory(const QString &buildConfiguration) const
 {
     Q_UNUSED(buildConfiguration)
     //TODO
-    return "";
+    return QFileInfo(m_fileName).absolutePath();
 }
 
 ProjectExplorer::BuildStepConfigWidget *CMakeProject::createConfigWidget()
@@ -230,7 +232,23 @@ void CMakeProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &w
 void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
 {
     // TODO
-    Q_UNUSED(reader)
+    Q_UNUSED(reader);
+    if (buildConfigurations().isEmpty()) {
+        // No build configuration, adding those
+
+        // TODO do we want to create one build configuration per target?
+        // or how do we want to handle that?
+
+        CMakeStep *cmakeStep = new CMakeStep(this);
+        MakeStep *makeStep = new MakeStep(this);
+
+        insertBuildStep(0, cmakeStep);
+        insertBuildStep(1, makeStep);
+
+        addBuildConfiguration("all");
+        setActiveBuildConfiguration("all");
+    }
+    // Restoring is fine
 }
 
 
diff --git a/src/plugins/cmakeprojectmanager/cmakestep.cpp b/src/plugins/cmakeprojectmanager/cmakestep.cpp
index 523741c92ba..0c267ca2c4c 100644
--- a/src/plugins/cmakeprojectmanager/cmakestep.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakestep.cpp
@@ -54,7 +54,7 @@ bool CMakeStep::init(const QString &buildConfiguration)
     setEnabled(buildConfiguration, true);
     setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration));
     setCommand(buildConfiguration, "cmake"); // TODO give full path here?
-    setArguments(buildConfiguration, QStringList()); // TODO
+    setArguments(buildConfiguration, QStringList() << "-GUnix Makefiles"); // TODO
     setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration));
     return AbstractProcessStep::init(buildConfiguration);
 }
-- 
GitLab