From 3f2dd9bc54d1dfc47fcf8e22979e409ad50e875a Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 28 May 2007 10:25:03 -0400 Subject: [PATCH] ENH: Made cmTarget::GetSourceFiles method return reference to const so addition of cmSourceFile pointers must be done with an access method in cmTarget. --- Source/cmFLTKWrapUICommand.cxx | 4 ++-- Source/cmLocalGenerator.cxx | 6 +++--- Source/cmTarget.cxx | 2 +- Source/cmTarget.h | 4 +++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index f761a59c7..80abd674f 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -158,8 +158,8 @@ void cmFLTKWrapUICommand::FinalPass() // Generate code for all the .fl files for(size_t classNum = 0; classNum < lastHeadersClass; classNum++) { - this->Makefile->GetTargets()[this->Target].GetSourceFiles(). - push_back(this->GeneratedSourcesClasses[classNum]); + this->Makefile->GetTargets()[this->Target] + .AddSourceFile(this->GeneratedSourcesClasses[classNum]); } } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index bc0aca44f..f831282fe 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -622,8 +622,8 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) cmStdString objs; std::vector objVector; // Add all the sources outputs to the depends of the target - std::vector& classes = target.GetSourceFiles(); - for(std::vector::iterator i = classes.begin(); + std::vector const& classes = target.GetSourceFiles(); + for(std::vector::const_iterator i = classes.begin(); i != classes.end(); ++i) { if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY") && @@ -706,7 +706,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) comment.c_str(), this->Makefile->GetStartOutputDirectory() ); - target.GetSourceFiles().push_back + target.AddSourceFile (this->Makefile->GetSource(targetFullPath.c_str())); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ac8d34bfd..c4417bb2f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -454,7 +454,7 @@ void cmTarget::TraceVSDependencies(std::string projFile, cmMakefile *makefile) { // get the classes from the source lists then add them to the groups - std::vector & classes = this->GetSourceFiles(); + std::vector & classes = this->SourceFiles; // use a deck to keep track of processed source files std::queue srcFilesToProcess; std::set srcFilesQueued; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 454c95de2..97f574d74 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -89,7 +89,9 @@ public: /** * Get the list of the source files used by this target */ - std::vector &GetSourceFiles() {return this->SourceFiles;} + std::vector const &GetSourceFiles() + {return this->SourceFiles;} + void AddSourceFile(cmSourceFile* sf) { this->SourceFiles.push_back(sf); } /** * Get the list of the source files used by this target