From 531e40b95e80fbf5547b0a8d71196e819bb3aa3d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 14 Jul 2013 18:22:57 +0200 Subject: cmTarget: Make GetSourceFiles populate an out-vector parameter. In a future patch, this will also be populated with extra sources from the linked dependencies. --- Source/cmExtraCodeBlocksGenerator.cxx | 3 ++- Source/cmExtraEclipseCDT4Generator.cxx | 3 ++- Source/cmExtraSublimeTextGenerator.cxx | 3 ++- Source/cmFLTKWrapUICommand.cxx | 4 ++-- Source/cmGeneratorTarget.cxx | 10 ++++++---- Source/cmGeneratorTarget.h | 2 +- Source/cmGlobalGenerator.cxx | 3 ++- Source/cmGlobalKdevelopGenerator.cxx | 3 ++- Source/cmGlobalXCodeGenerator.cxx | 12 ++++++++---- Source/cmLocalGenerator.cxx | 6 ++++-- Source/cmLocalVisualStudio6Generator.cxx | 3 ++- Source/cmLocalVisualStudio7Generator.cxx | 3 ++- Source/cmMakefileTargetGenerator.cxx | 4 ++-- Source/cmNinjaUtilityTargetGenerator.cxx | 4 ++-- Source/cmQtAutoGenerators.cxx | 12 ++++++++---- Source/cmTarget.cxx | 7 ++++--- Source/cmTarget.h | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 3 ++- 18 files changed, 54 insertions(+), 33 deletions(-) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index fce1284..a066153 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -398,7 +398,8 @@ void cmExtraCodeBlocksGenerator case cmTarget::OBJECT_LIBRARY: case cmTarget::UTILITY: // can have sources since 2.6.3 { - const std::vector&sources=ti->second.GetSourceFiles(); + std::vector sources; + ti->second.GetSourceFiles(sources); for (std::vector::const_iterator si=sources.begin(); si!=sources.end(); si++) { diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index c93187e..3e9b786 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -559,7 +559,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets( std::vector sourceGroups=makefile->GetSourceGroups(); // get the files from the source lists then add them to the groups cmTarget* tgt = const_cast(&ti->second); - std::vectorconst & files = tgt->GetSourceFiles(); + std::vector files; + tgt->GetSourceFiles(files); for(std::vector::const_iterator sfIt = files.begin(); sfIt != files.end(); sfIt++) diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 9cbdd7c..52411e8 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -237,7 +237,8 @@ void cmExtraSublimeTextGenerator:: { cmGeneratorTarget *gtgt = this->GlobalGenerator ->GetGeneratorTarget(target); - std::vector const& sourceFiles = target->GetSourceFiles(); + std::vector sourceFiles; + target->GetSourceFiles(sourceFiles); std::vector::const_iterator sourceFilesEnd = sourceFiles.end(); for (std::vector::const_iterator iter = diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index b08c335..4ce1ea5 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -132,8 +132,8 @@ void cmFLTKWrapUICommand::FinalPass() cmSystemTools::Message(msg.c_str(),"Warning"); return; } - std::vector const& srcs = - target->GetSourceFiles(); + std::vector srcs; + target->GetSourceFiles(srcs); bool found = false; for (unsigned int i = 0; i < srcs.size(); ++i) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 88f533c..5cd1f42 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -284,9 +284,9 @@ bool cmGeneratorTarget::GetPropertyAsBool(const char *prop) const } //---------------------------------------------------------------------------- -std::vector const& cmGeneratorTarget::GetSourceFiles() const +void cmGeneratorTarget::GetSourceFiles(std::vector &files) const { - return this->Target->GetSourceFiles(); + this->Target->GetSourceFiles(files); } //---------------------------------------------------------------------------- @@ -298,7 +298,8 @@ void cmGeneratorTarget::ClassifySources() bool isObjLib = targetType == cmTarget::OBJECT_LIBRARY; std::vector badObjLib; - std::vector const& sources = this->Target->GetSourceFiles(); + std::vector sources; + this->Target->GetSourceFiles(sources); for(std::vector::const_iterator si = sources.begin(); si != sources.end(); ++si) { @@ -496,7 +497,8 @@ cmTargetTraceDependencies this->CurrentEntry = 0; // Queue all the source files already specified for the target. - std::vector const& sources = this->Target->GetSourceFiles(); + std::vector sources; + this->Target->GetSourceFiles(sources); for(std::vector::const_iterator si = sources.begin(); si != sources.end(); ++si) { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 4c023bf..17a223a 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -30,7 +30,7 @@ public: const char *GetName() const; const char *GetProperty(const char *prop) const; bool GetPropertyAsBool(const char *prop) const; - std::vector const& GetSourceFiles() const; + void GetSourceFiles(std::vector& files) const; void GetObjectSources(std::vector &) const; const std::string& GetObjectName(cmSourceFile const* file); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 82c9155..f5914c8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2884,7 +2884,8 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target) // List the source files with any per-source labels. fout << "# Source files and their labels\n"; - std::vector const& sources = target->GetSourceFiles(); + std::vector sources; + target->GetSourceFiles(sources); for(std::vector::const_iterator si = sources.begin(); si != sources.end(); ++si) { diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 61ff45b..ed0e15b 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -138,7 +138,8 @@ bool cmGlobalKdevelopGenerator for (cmTargets::iterator ti = targets.begin(); ti != targets.end(); ti++) { - const std::vector& sources=ti->second.GetSourceFiles(); + std::vector sources; + ti->second.GetSourceFiles(sources); for (std::vector::const_iterator si=sources.begin(); si!=sources.end(); si++) { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 09d8124..f7a42fc 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -991,7 +991,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, } // organize the sources - std::vector classes = cmtarget.GetSourceFiles(); + std::vector classes; + cmtarget.GetSourceFiles(classes); std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); std::vector externalObjFiles; @@ -1360,7 +1361,8 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases, postbuild.push_back(command); } - std::vectorconst &classes = cmtarget.GetSourceFiles(); + std::vector classes; + cmtarget.GetSourceFiles(classes); // add all the sources std::vector commands; for(std::vector::const_iterator i = classes.begin(); @@ -2442,7 +2444,8 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) // Add source files without build rules for editing convenience. if(cmtarget.GetType() == cmTarget::UTILITY) { - std::vector const& sources = cmtarget.GetSourceFiles(); + std::vector sources; + cmtarget.GetSourceFiles(sources); for(std::vector::const_iterator i = sources.begin(); i != sources.end(); ++i) { @@ -2945,7 +2948,8 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, cmtarget.AddSourceFile(sf); } - std::vector classes = cmtarget.GetSourceFiles(); + std::vector classes; + cmtarget.GetSourceFiles(classes); // Put cmSourceFile instances in proper groups: for(std::vector::const_iterator s = classes.begin(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 455f542..3effe38 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -657,7 +657,8 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmStdString objs; std::vector objVector; // Add all the sources outputs to the depends of the target - std::vector const& classes = target.GetSourceFiles(); + std::vector classes; + target.GetSourceFiles(classes); for(std::vector::const_iterator i = classes.begin(); i != classes.end(); ++i) { @@ -1631,7 +1632,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) { - const std::vector& sources = target->GetSourceFiles(); + std::vector sources; + target->GetSourceFiles(sources); for(std::vector::const_iterator i = sources.begin(); i != sources.end(); ++i) { diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index f10216a..fb12521 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -314,7 +314,8 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, std::vector sourceGroups = this->Makefile->GetSourceGroups(); // get the classes from the source lists then add them to the groups - std::vector const & classes = target.GetSourceFiles(); + std::vector classes; + target.GetSourceFiles(classes); // now all of the source files have been properly assigned to the target // now stick them into source groups using the reg expressions diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 1a47ca3..57a4880 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1381,7 +1381,8 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, // get the classes from the source lists then add them to the groups this->ModuleDefinitionFile = ""; - std::vectorconst & classes = target.GetSourceFiles(); + std::vector classes; + target.GetSourceFiles(classes); for(std::vector::const_iterator i = classes.begin(); i != classes.end(); i++) { diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 25b2b4c..7f90078 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1152,8 +1152,8 @@ cmMakefileTargetGenerator ::DriveCustomCommands(std::vector& depends) { // Depend on all custom command outputs. - const std::vector& sources = - this->Target->GetSourceFiles(); + std::vector sources; + this->Target->GetSourceFiles(sources); for(std::vector::const_iterator source = sources.begin(); source != sources.end(); ++source) { diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 8556565..1a7b445 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -42,8 +42,8 @@ void cmNinjaUtilityTargetGenerator::Generate() } } - const std::vector& sources = - this->GetTarget()->GetSourceFiles(); + std::vector sources; + this->GetTarget()->GetSourceFiles(sources); for(std::vector::const_iterator source = sources.begin(); source != sources.end(); ++source) { diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index bd7e75a..da22ab5 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -451,7 +451,8 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, const char* sepFiles = ""; const char* sepHeaders = ""; - const std::vector& srcFiles = target->GetSourceFiles(); + std::vector srcFiles; + target->GetSourceFiles(srcFiles); std::string skip_moc; const char *sep = ""; @@ -643,7 +644,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, const char *qtUic = makefile->GetSafeDefinition("QT_UIC_EXECUTABLE"); makefile->AddDefinition("_qt_uic_executable", qtUic); - const std::vector& srcFiles = target->GetSourceFiles(); + std::vector srcFiles; + target->GetSourceFiles(srcFiles); std::string skip_uic; const char *sep = ""; @@ -809,7 +811,8 @@ void cmQtAutoGenerators::InitializeAutoRccTarget(cmTarget* target) { cmMakefile *makefile = target->GetMakefile(); - const std::vector& srcFiles = target->GetSourceFiles(); + std::vector srcFiles; + target->GetSourceFiles(srcFiles); std::vector newFiles; @@ -855,7 +858,8 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) const char* sepRccFiles = ""; cmMakefile *makefile = target->GetMakefile(); - const std::vector& srcFiles = target->GetSourceFiles(); + std::vector srcFiles; + target->GetSourceFiles(srcFiles); std::string rccFileFiles; std::string rccFileOptions; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b06480b..d65117d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -530,9 +530,9 @@ bool cmTarget::FindSourceFiles() } //---------------------------------------------------------------------------- -std::vector const& cmTarget::GetSourceFiles() const +void cmTarget::GetSourceFiles(std::vector &files) const { - return this->SourceFiles; + files = this->SourceFiles; } //---------------------------------------------------------------------------- @@ -673,7 +673,8 @@ void cmTarget::ConstructSourceFileFlags() const // Handle the MACOSX_PACKAGE_LOCATION property on source files that // were not listed in one of the other lists. - std::vector const& sources = this->GetSourceFiles(); + std::vector sources; + this->GetSourceFiles(sources); for(std::vector::const_iterator si = sources.begin(); si != sources.end(); ++si) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 4916648..26d391f 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -132,7 +132,7 @@ public: /** * Get the list of the source files used by this target */ - std::vector const& GetSourceFiles() const; + void GetSourceFiles(std::vector &files) const; void AddSourceFile(cmSourceFile* sf); std::vector const& GetObjectLibraries() const { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 0a2c339..46ab383 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -699,7 +699,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups() // collect up group information std::vector sourceGroups = this->Makefile->GetSourceGroups(); - std::vector classes = this->Target->GetSourceFiles(); + std::vector classes; + this->Target->GetSourceFiles(classes); std::set groupsUsed; for(std::vector::const_iterator s = classes.begin(); -- cgit v0.12