diff options
author | Brad King <brad.king@kitware.com> | 2006-10-02 14:49:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-10-02 14:49:55 (GMT) |
commit | 603b47c87a6b7bbf99dfd13e4b874ee51e528434 (patch) | |
tree | ae61738e252199a270c6fd4126c4d693e87af0e0 /Source/cmGlobalKdevelopGenerator.cxx | |
parent | e4ec89d0360408cc4ad2bb6428be06749d8b11ba (diff) | |
download | CMake-603b47c87a6b7bbf99dfd13e4b874ee51e528434.zip CMake-603b47c87a6b7bbf99dfd13e4b874ee51e528434.tar.gz CMake-603b47c87a6b7bbf99dfd13e4b874ee51e528434.tar.bz2 |
ENH: Patch from Alex to help with KDevelop code completion in generated projects.
Diffstat (limited to 'Source/cmGlobalKdevelopGenerator.cxx')
-rw-r--r-- | Source/cmGlobalKdevelopGenerator.cxx | 24 |
1 files changed, 23 insertions, 1 deletions
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 <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(); |