ENH: Patch from Alex to help with KDevelop code completion in generated projects.

This commit is contained in:
Brad King 2006-10-02 10:49:55 -04:00
parent e4ec89d036
commit 603b47c87a
1 changed files with 23 additions and 1 deletions

View File

@ -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 @@ 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<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();