ENH: Made cmTarget::GetSourceFiles method return reference to const so addition of cmSourceFile pointers must be done with an access method in cmTarget.

This commit is contained in:
Brad King 2007-05-28 10:25:03 -04:00
parent ba8ec0d5cf
commit 3f2dd9bc54
4 changed files with 9 additions and 7 deletions

View File

@ -158,8 +158,8 @@ void cmFLTKWrapUICommand::FinalPass()
// Generate code for all the .fl files // Generate code for all the .fl files
for(size_t classNum = 0; classNum < lastHeadersClass; classNum++) for(size_t classNum = 0; classNum < lastHeadersClass; classNum++)
{ {
this->Makefile->GetTargets()[this->Target].GetSourceFiles(). this->Makefile->GetTargets()[this->Target]
push_back(this->GeneratedSourcesClasses[classNum]); .AddSourceFile(this->GeneratedSourcesClasses[classNum]);
} }
} }
} }

View File

@ -622,8 +622,8 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
cmStdString objs; cmStdString objs;
std::vector<std::string> objVector; std::vector<std::string> objVector;
// Add all the sources outputs to the depends of the target // Add all the sources outputs to the depends of the target
std::vector<cmSourceFile*>& classes = target.GetSourceFiles(); std::vector<cmSourceFile*> const& classes = target.GetSourceFiles();
for(std::vector<cmSourceFile*>::iterator i = classes.begin(); for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
i != classes.end(); ++i) i != classes.end(); ++i)
{ {
if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY") && if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY") &&
@ -706,7 +706,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
comment.c_str(), comment.c_str(),
this->Makefile->GetStartOutputDirectory() this->Makefile->GetStartOutputDirectory()
); );
target.GetSourceFiles().push_back target.AddSourceFile
(this->Makefile->GetSource(targetFullPath.c_str())); (this->Makefile->GetSource(targetFullPath.c_str()));
} }

View File

@ -454,7 +454,7 @@ void cmTarget::TraceVSDependencies(std::string projFile,
cmMakefile *makefile) cmMakefile *makefile)
{ {
// get the classes from the source lists then add them to the groups // get the classes from the source lists then add them to the groups
std::vector<cmSourceFile*> & classes = this->GetSourceFiles(); std::vector<cmSourceFile*> & classes = this->SourceFiles;
// use a deck to keep track of processed source files // use a deck to keep track of processed source files
std::queue<std::string> srcFilesToProcess; std::queue<std::string> srcFilesToProcess;
std::set<cmStdString> srcFilesQueued; std::set<cmStdString> srcFilesQueued;

View File

@ -89,7 +89,9 @@ public:
/** /**
* Get the list of the source files used by this target * Get the list of the source files used by this target
*/ */
std::vector<cmSourceFile*> &GetSourceFiles() {return this->SourceFiles;} std::vector<cmSourceFile*> 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 * Get the list of the source files used by this target