From 5e5192ad57a4383a8f79859e9eabe8196a20af73 Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@nokia.com>
Date: Mon, 22 Feb 2010 11:34:47 +0100
Subject: [PATCH] Fix CMake projects

 * Fix initial setup of .user-files in CMake projects

Reviewed-by: dt
---
 src/plugins/cmakeprojectmanager/cmakeproject.cpp | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 6bc709cabb5..318d78788af 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -471,14 +471,11 @@ bool CMakeProject::fromMap(const QVariantMap &map)
     if (!Project::fromMap(map))
         return false;
 
-    bool hasUserFile = activeTarget() &&
-                       activeTarget()->activeBuildConfiguration();
+    bool hasUserFile = activeTarget();
     if (!hasUserFile) {
-        CMakeTarget *t(0);
-        if (!activeTarget())
-            t = new CMakeTarget(this);
-        else
-            t = activeTarget();
+        CMakeTarget *t = targetFactory()->create(this, QLatin1String(DEFAULT_CMAKE_TARGET_ID));
+        Q_ASSERT(t);
+        Q_ASSERT(t->activeBuildConfiguration());
 
         // Ask the user for where he wants to build it
         // and the cmake command line
-- 
GitLab