From 603b47c87a6b7bbf99dfd13e4b874ee51e528434 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 2 Oct 2006 10:49:55 -0400 Subject: ENH: Patch from Alex to help with KDevelop code completion in generated projects. --- Source/cmGlobalKdevelopGenerator.cxx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index d7717cd..d07fd60 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -23,6 +23,8 @@ #include "cmSourceFile.h" #include "cmGeneratedFileStream.h" +#include + cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator() { // This type of makefile always requires unix style paths @@ -160,12 +162,32 @@ bool cmGlobalKdevelopGenerator 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::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::const_iterator lt=listFiles.begin(); -- cgit v0.12