[cmake-commits] king committed cmGlobalKdevelopGenerator.cxx 1.17 1.18

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Oct 2 10:50:00 EDT 2006


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

Modified Files:
	cmGlobalKdevelopGenerator.cxx 
Log Message:
ENH: Patch from Alex to help with KDevelop code completion in generated projects.


Index: cmGlobalKdevelopGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalKdevelopGenerator.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cmGlobalKdevelopGenerator.cxx	29 Aug 2006 20:08:32 -0000	1.17
+++ cmGlobalKdevelopGenerator.cxx	2 Oct 2006 14:49:55 -0000	1.18
@@ -23,6 +23,8 @@
 #include "cmSourceFile.h"
 #include "cmGeneratedFileStream.h"
 
+#include <cmsys/SystemTools.hxx>
+
 cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
 {
   // This type of makefile always requires unix style paths
@@ -160,12 +162,32 @@
            si!=sources.end(); si++)
         {
         tmp=(*si)->GetFullPath();
+        std::string headerBasename=cmSystemTools::GetFilenamePath(tmp);
+        headerBasename+="/";
+        headerBasename+=cmSystemTools::GetFilenameWithoutExtension(tmp);
+
         cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
+
         if ((tmp[0]!='/')  && 
             (strstr(tmp.c_str(), 
-                    cmake::GetCMakeFilesDirectoryPostSlash())==0))
+                  cmake::GetCMakeFilesDirectoryPostSlash())==0) &&
+           (cmSystemTools::GetFilenameExtension(tmp)!=".moc"))
           {
           files.insert(tmp);
+
+          // check if there's a matching header around
+          for( std::vector<std::string>::const_iterator ext =  makefile->GetHeaderExtensions().begin();
+               ext !=  makefile->GetHeaderExtensions().end(); ++ext )
+            {
+            std::string hname=headerBasename;
+            hname += ".";
+            hname += *ext;
+            if(cmSystemTools::FileExists(hname.c_str()))
+              {
+              files.insert(hname);
+              break;
+              }
+            }
           }
         }
       for (std::vector<std::string>::const_iterator lt=listFiles.begin();



More information about the Cmake-commits mailing list