From 723d90c51ddb05b94150f373071c410d3b3f2627 Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Fri, 3 Jul 2009 18:56:48 +0200
Subject: [PATCH] Fix updating the codemodel for cmake on switching
 buildconfigurations

That is we update all files with the new include and defines if we are
switching toolchains.
---
 .../cmakeprojectmanager/cmakeproject.cpp       | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index aae70be1159..670c2d57cfc 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -228,12 +228,18 @@ bool CMakeProject::parseCMakeLists()
         CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
         if (modelmanager) {
             CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
-            pinfo.includePaths = allIncludePaths;
-            // TODO we only want C++ files, not all other stuff that might be in the project
-            pinfo.sourceFiles = m_files;
-            pinfo.defines = m_toolChain->predefinedMacros(); // TODO this is to simplistic
-            pinfo.frameworkPaths = allFrameworkPaths;
-            modelmanager->updateProjectInfo(pinfo);
+            if (pinfo.includePaths != allIncludePaths
+                || pinfo.sourceFiles != m_files
+                || pinfo.defines != m_toolChain->predefinedMacros()
+                || pinfo.frameworkPaths != allFrameworkPaths)  {
+                pinfo.includePaths = allIncludePaths;
+                // TODO we only want C++ files, not all other stuff that might be in the project
+                pinfo.sourceFiles = m_files;
+                pinfo.defines = m_toolChain->predefinedMacros(); // TODO this is to simplistic
+                pinfo.frameworkPaths = allFrameworkPaths;
+                modelmanager->updateProjectInfo(pinfo);
+                modelmanager->updateSourceFiles(pinfo.sourceFiles);
+            }
         }
 
         // Create run configurations for m_targets
-- 
GitLab