From 62c00cfaedff6e5d0a75a5fa19b178fb26a69b82 Mon Sep 17 00:00:00 2001
From: Oleksii Serdiuk <contacts@oleksii.name>
Date: Tue, 29 Oct 2013 17:25:06 +0100
Subject: [PATCH] CMake: Fix for "The source directory does not contain
 CMakeLists.txt".

CMakeBuildInfo::sourceDirectory wasn't always populated, which sometimes
led to 'CMake Error: The source directory "<path>" does not appear to
contain CMakeLists.txt.' error when re-running CMake for shadow builds.

Change-Id: I4caece897155ee9e056d2da8185da43b94cbd99d
Reviewed-by: hjk <hjk121@nokiamail.com>
---
 src/plugins/cmakeprojectmanager/cmakebuildinfo.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/plugins/cmakeprojectmanager/cmakebuildinfo.h b/src/plugins/cmakeprojectmanager/cmakebuildinfo.h
index e4cd8e1ed60..8464057b367 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildinfo.h
+++ b/src/plugins/cmakeprojectmanager/cmakebuildinfo.h
@@ -35,7 +35,9 @@
 #include <projectexplorer/buildinfo.h>
 #include <projectexplorer/kit.h>
 #include <projectexplorer/target.h>
+#include <projectexplorer/project.h>
 #include <utils/environment.h>
+#include <utils/qtcassert.h>
 
 namespace CMakeProjectManager {
 
@@ -53,6 +55,9 @@ public:
         kitId = bc->target()->kit()->id();
         environment = bc->environment();
         useNinja = bc->useNinja();
+
+        QTC_ASSERT(bc->target()->project(), return);
+        sourceDirectory = bc->target()->project()->projectDirectory();
     }
 
     Utils::Environment environment;
-- 
GitLab