[cmake-commits] alex committed cmGlobalKdevelopGenerator.h 1.6 1.7 cmGlobalKdevelopGenerator.cxx 1.25 1.26

cmake-commits at cmake.org cmake-commits at cmake.org
Sun Aug 26 19:27:36 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv21667

Modified Files:
	cmGlobalKdevelopGenerator.h cmGlobalKdevelopGenerator.cxx 
Log Message:

ENH: add all subdirs of the project to the kdevelop blacklist, so kdevelop
doesn't watch these dirs for added or remved files everytime it is started

Alex


Index: cmGlobalKdevelopGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalKdevelopGenerator.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cmGlobalKdevelopGenerator.h	8 Jun 2007 15:57:16 -0000	1.6
+++ cmGlobalKdevelopGenerator.h	26 Aug 2007 23:27:33 -0000	1.7
@@ -92,7 +92,7 @@
                             const std::string& fileToOpen,
                             const std::string& sessionFilename);
 
-  
+  std::vector<std::string> Blacklist;
 };
 
 #endif

Index: cmGlobalKdevelopGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalKdevelopGenerator.cxx,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- cmGlobalKdevelopGenerator.cxx	21 Aug 2007 17:47:29 -0000	1.25
+++ cmGlobalKdevelopGenerator.cxx	26 Aug 2007 23:27:33 -0000	1.26
@@ -23,8 +23,10 @@
 #include "cmake.h"
 #include "cmSourceFile.h"
 #include "cmGeneratedFileStream.h"
+#include "cmSystemTools.h"
 
 #include <cmsys/SystemTools.hxx>
+#include <cmsys/Directory.hxx>
 
 //----------------------------------------------------------------------------
 void cmGlobalKdevelopGenerator
@@ -273,6 +275,32 @@
                     const std::string& cmakeFilePattern,
                     const std::string& fileToOpen)
 {
+  // add all subdirectories to the kdevelop blacklist
+  // so they are not monitored for added or removed files
+  // since this is basically handled by adding files to the
+  // cmake files
+  this->Blacklist.clear();
+  cmsys::Directory d;
+  if (d.Load(projectDir.c_str()))
+    {
+    unsigned int i;
+    size_t numf = d.GetNumberOfFiles();
+    for (unsigned int i = 0; i < numf; i++)
+      {
+      std::string nextFile = d.GetFile(i);
+      if ((nextFile!=".") && (nextFile!=".."))
+        {
+        std::string tmp = projectDir;
+        tmp += "/";
+        tmp += nextFile;
+        if (cmSystemTools::FileIsDirectory(tmp.c_str()))
+          {
+          this->Blacklist.push_back(nextFile);
+          }
+        }
+      }
+    }
+
   std::string filename=outputDir+"/";
   filename+=projectname+".kdevelop";
   std::string sessionFilename=outputDir+"/";
@@ -290,7 +318,7 @@
                                executable, cmakeFilePattern, 
                                fileToOpen, sessionFilename);
     }
-   
+
 }
 
 void cmGlobalKdevelopGenerator
@@ -388,7 +416,7 @@
   // check for a version control system
   bool hasSvn = cmSystemTools::FileExists((projectDir + "/.svn").c_str());
   bool hasCvs = cmSystemTools::FileExists((projectDir + "/CVS").c_str());
-
+  
   fout<<"<?xml version = '1.0'?>\n";
   fout<<"<kdevelop>\n";
   fout<<"  <general>\n";
@@ -441,6 +469,16 @@
   fout<<"        <default/>\n";
   fout<<"      </environments>\n";
   fout<<"    </make>\n";
+
+  fout<<"    <blacklist>\n";
+  for(std::vector<std::string>::const_iterator dirIt=this->Blacklist.begin();
+      dirIt != this->Blacklist.end();
+      ++dirIt)
+    {
+    fout<<"      <path>"<<dirIt->c_str()<<"</path>\n";
+    }
+  fout<<"    </blacklist>\n";
+
   fout<<"  </kdevcustomproject>\n";
   fout<<"  <kdevfilecreate>\n";
   fout<<"    <filetypes/>\n";



More information about the Cmake-commits mailing list