diff options
-rw-r--r-- | Source/cmAuxSourceDirectoryCommand.cxx | 8 | ||||
-rw-r--r-- | Source/cmExtraCodeBlocksGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmExtraCodeLiteGenerator.cxx | 13 | ||||
-rw-r--r-- | Source/cmGlobalKdevelopGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 25 | ||||
-rw-r--r-- | Source/cmMakefile.h | 13 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 2 | ||||
-rw-r--r-- | Source/cmSourceFile.cxx | 6 | ||||
-rw-r--r-- | Source/cmSourceFileLocation.cxx | 12 | ||||
-rw-r--r-- | Source/cmake.cxx | 24 | ||||
-rw-r--r-- | Source/cmake.h | 7 |
12 files changed, 70 insertions, 62 deletions
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 5f5017d..92ac07d 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -60,10 +60,10 @@ bool cmAuxSourceDirectoryCommand::InitialPass std::string ext = file.substr(dotpos+1); std::string base = file.substr(0, dotpos); // Process only source files - if(!base.empty() - && std::find( this->Makefile->GetSourceExtensions().begin(), - this->Makefile->GetSourceExtensions().end(), ext ) - != this->Makefile->GetSourceExtensions().end() ) + std::vector<std::string> srcExts = + this->Makefile->GetCMakeInstance()->GetSourceExtensions(); + if(!base.empty() && + std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end()) { std::string fullname = templateDirectory; fullname += "/"; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 597c9d8..9348ef2 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -383,6 +383,9 @@ void cmExtraCodeBlocksGenerator all_files_map_t allFiles; std::vector<std::string> cFiles; + std::vector<std::string> srcExts = + this->GlobalGenerator->GetCMakeInstance()->GetSourceExtensions(); + for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin(); lg!=lgs.end(); lg++) { @@ -420,9 +423,7 @@ void cmExtraCodeBlocksGenerator { std::string srcext = (*si)->GetExtension(); for(std::vector<std::string>::const_iterator - ext = mf->GetSourceExtensions().begin(); - ext != mf->GetSourceExtensions().end(); - ++ext) + ext = srcExts.begin(); ext != srcExts.end(); ++ext) { if (srcext == *ext) { @@ -449,6 +450,9 @@ void cmExtraCodeBlocksGenerator } } + std::vector<std::string> headerExts = + this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions(); + // The following loop tries to add header files matching to implementation // files to the project. It does that by iterating over all // C/C++ source files, @@ -468,8 +472,8 @@ void cmExtraCodeBlocksGenerator // check if there's a matching header around for(std::vector<std::string>::const_iterator - ext = mf->GetHeaderExtensions().begin(); - ext != mf->GetHeaderExtensions().end(); + ext = headerExts.begin(); + ext != headerExts.end(); ++ext) { std::string hname=headerBasename; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index f4a6537..67aa157 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -149,6 +149,11 @@ void cmExtraCodeLiteGenerator // which may have an acompanying header, one for all other files std::string projectType; + std::vector<std::string> srcExts = + this->GlobalGenerator->GetCMakeInstance()->GetSourceExtensions(); + std::vector<std::string> headerExts = + this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions(); + std::map<std::string, cmSourceFile*> cFiles; std::set<std::string> otherFiles; for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin(); @@ -207,9 +212,7 @@ void cmExtraCodeLiteGenerator { std::string srcext = (*si)->GetExtension(); for(std::vector<std::string>::const_iterator - ext = mf->GetSourceExtensions().begin(); - ext != mf->GetSourceExtensions().end(); - ++ext) + ext = srcExts.begin(); ext != srcExts.end(); ++ext) { if (srcext == *ext) { @@ -253,8 +256,8 @@ void cmExtraCodeLiteGenerator // check if there's a matching header around for(std::vector<std::string>::const_iterator - ext = mf->GetHeaderExtensions().begin(); - ext != mf->GetHeaderExtensions().end(); + ext = headerExts.begin(); + ext != headerExts.end(); ++ext) { std::string hname=headerBasename; diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 7c6c48c..018ab24 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -105,6 +105,9 @@ bool cmGlobalKdevelopGenerator std::set<std::string> files; std::string tmp; + std::vector<std::string> hdrExts = + this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions(); + for (std::vector<cmLocalGenerator*>::const_iterator it=lgs.begin(); it!=lgs.end(); it++) { @@ -160,8 +163,7 @@ bool cmGlobalKdevelopGenerator // check if there's a matching header around for(std::vector<std::string>::const_iterator - ext = makefile->GetHeaderExtensions().begin(); - ext != makefile->GetHeaderExtensions().end(); ++ext) + ext = hdrExts.begin(); ext != hdrExts.end(); ++ext) { std::string hname=headerBasename; hname += "."; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 9a5c367..5737bee 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1420,7 +1420,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf) { const std::vector<std::string>& hdrExts = - this->CurrentMakefile->GetHeaderExtensions(); + this->CMakeInstance->GetHeaderExtensions(); return (std::find(hdrExts.begin(), hdrExts.end(), sf->GetExtension()) != hdrExts.end()); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 361aa99..3bf34e2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -57,31 +57,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator, // Setup the default include complaint regular expression (match nothing). this->ComplainFileRegularExpression = "^$"; - // Source and header file extensions that we can handle - - // Set up a list of source and header extensions - // these are used to find files when the extension - // is not given - // The "c" extension MUST precede the "C" extension. - this->SourceFileExtensions.push_back( "c" ); - this->SourceFileExtensions.push_back( "C" ); - - this->SourceFileExtensions.push_back( "c++" ); - this->SourceFileExtensions.push_back( "cc" ); - this->SourceFileExtensions.push_back( "cpp" ); - this->SourceFileExtensions.push_back( "cxx" ); - this->SourceFileExtensions.push_back( "m" ); - this->SourceFileExtensions.push_back( "M" ); - this->SourceFileExtensions.push_back( "mm" ); - - this->HeaderFileExtensions.push_back( "h" ); - this->HeaderFileExtensions.push_back( "hh" ); - this->HeaderFileExtensions.push_back( "h++" ); - this->HeaderFileExtensions.push_back( "hm" ); - this->HeaderFileExtensions.push_back( "hpp" ); - this->HeaderFileExtensions.push_back( "hxx" ); - this->HeaderFileExtensions.push_back( "in" ); - this->HeaderFileExtensions.push_back( "txx" ); this->DefineFlags = " "; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 725448b..f3dbb74 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -425,17 +425,6 @@ public: cmSourceFile* GetOrCreateSource(const std::string& sourceName, bool generated = false); - //@{ - /** - * Return a list of extensions associated with source and header - * files - */ - const std::vector<std::string>& GetSourceExtensions() const - {return this->SourceFileExtensions;} - const std::vector<std::string>& GetHeaderExtensions() const - {return this->HeaderFileExtensions;} - //@} - /** * Given a variable name, return its value (as a string). * If the variable is not found in this makefile instance, the @@ -823,8 +812,6 @@ protected: std::vector<cmTestGenerator*> TestGenerators; std::string ComplainFileRegularExpression; - std::vector<std::string> SourceFileExtensions; - std::vector<std::string> HeaderFileExtensions; std::string DefineFlags; // Track the value of the computed DEFINITIONS property. diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index fc690f8..b16eccd 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -528,7 +528,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) cmSystemTools::ExpandListArgument(this->Sources, sourceFiles); const std::vector<std::string>& headerExtensions = - makefile->GetHeaderExtensions(); + makefile->GetCMakeInstance()->GetHeaderExtensions(); std::map<std::string, std::vector<std::string> > includedUis; std::map<std::string, std::vector<std::string> > skippedUis; diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 37383be..a9ac549 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -167,8 +167,10 @@ bool cmSourceFile::FindFullPath(std::string* error) { tryDirs[0] = ""; } - const std::vector<std::string>& srcExts = mf->GetSourceExtensions(); - const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions(); + const std::vector<std::string>& srcExts = + mf->GetCMakeInstance()->GetSourceExtensions(); + std::vector<std::string> hdrExts = + mf->GetCMakeInstance()->GetHeaderExtensions(); for(const char* const* di = tryDirs; *di; ++di) { std::string tryPath = this->Location.GetDirectory(); diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index b8d5c02..00d5d6a 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -121,8 +121,10 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name) // The global generator checks extensions of enabled languages. cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); cmMakefile const* mf = this->Makefile; - const std::vector<std::string>& srcExts = mf->GetSourceExtensions(); - const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions(); + const std::vector<std::string>& srcExts = + mf->GetCMakeInstance()->GetSourceExtensions(); + const std::vector<std::string>& hdrExts = + mf->GetCMakeInstance()->GetHeaderExtensions(); if(!gg->GetLanguageFromExtension(ext.c_str()).empty() || std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end() || std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end()) @@ -193,12 +195,14 @@ cmSourceFileLocation // disk. One of these must match if loc refers to this source file. std::string const& ext = this->Name.substr(loc.Name.size()+1); cmMakefile const* mf = this->Makefile; - const std::vector<std::string>& srcExts = mf->GetSourceExtensions(); + const std::vector<std::string>& srcExts = + mf->GetCMakeInstance()->GetSourceExtensions(); if(std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end()) { return true; } - const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions(); + std::vector<std::string> hdrExts = + mf->GetCMakeInstance()->GetHeaderExtensions(); if(std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end()) { return true; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7268241..16417fc 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -165,6 +165,30 @@ cmake::cmake() // Make sure we can capture the build tool output. cmSystemTools::EnableVSConsoleOutput(); + + // Set up a list of source and header extensions + // these are used to find files when the extension + // is not given + // The "c" extension MUST precede the "C" extension. + this->SourceFileExtensions.push_back( "c" ); + this->SourceFileExtensions.push_back( "C" ); + + this->SourceFileExtensions.push_back( "c++" ); + this->SourceFileExtensions.push_back( "cc" ); + this->SourceFileExtensions.push_back( "cpp" ); + this->SourceFileExtensions.push_back( "cxx" ); + this->SourceFileExtensions.push_back( "m" ); + this->SourceFileExtensions.push_back( "M" ); + this->SourceFileExtensions.push_back( "mm" ); + + this->HeaderFileExtensions.push_back( "h" ); + this->HeaderFileExtensions.push_back( "hh" ); + this->HeaderFileExtensions.push_back( "h++" ); + this->HeaderFileExtensions.push_back( "hm" ); + this->HeaderFileExtensions.push_back( "hpp" ); + this->HeaderFileExtensions.push_back( "hxx" ); + this->HeaderFileExtensions.push_back( "in" ); + this->HeaderFileExtensions.push_back( "txx" ); } cmake::~cmake() diff --git a/Source/cmake.h b/Source/cmake.h index 9d28cba..6b0e83f 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -182,6 +182,11 @@ class cmake ///! get the cmCachemManager used by this invocation of cmake cmCacheManager *GetCacheManager() { return this->CacheManager; } + const std::vector<std::string>& GetSourceExtensions() const + {return this->SourceFileExtensions;} + const std::vector<std::string>& GetHeaderExtensions() const + {return this->HeaderFileExtensions;} + /** * Given a variable name, return its value (as a string). */ @@ -391,6 +396,8 @@ private: std::string CheckStampFile; std::string CheckStampList; std::string VSSolutionFile; + std::vector<std::string> SourceFileExtensions; + std::vector<std::string> HeaderFileExtensions; bool ClearBuildSystem; bool DebugTryCompile; cmFileTimeComparison* FileComparison; |