From 590d238914ff1b8652c0074e6715f51cad5eb7db Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jan 2014 00:38:54 +0100 Subject: cmTarget: Handle NO_SYSTEM_FROM_IMPORTED. This handling was lost in commit faedd2be (cmTarget: Fix system include annotation propagation., 2014-01-01). --- Source/cmGeneratorTarget.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6894cfc..2c976cd 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -65,7 +65,8 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const static void handleSystemIncludesDep(cmMakefile *mf, const std::string &name, const char *config, cmTarget *headTarget, cmGeneratorExpressionDAGChecker *dagChecker, - std::vector& result) + std::vector& result, + bool excludeImported) { cmTarget* depTgt = mf->FindTargetToUse(name.c_str()); @@ -85,7 +86,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, const std::string &name, config, false, headTarget, depTgt, dagChecker), result); } - if (!depTgt->IsImported()) + if (!depTgt->IsImported() || excludeImported) { return; } @@ -130,6 +131,9 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, this->GetName(), "SYSTEM_INCLUDE_DIRECTORIES", 0, 0); + bool excludeImported + = this->Target->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED"); + std::vector result; for (std::set::const_iterator it = this->Target->GetSystemIncludeDirectories().begin(); @@ -156,7 +160,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, } handleSystemIncludesDep(this->Makefile, *li, config, this->Target, - &dagChecker, result); + &dagChecker, result, excludeImported); std::vector deps; tgt->GetTransitivePropertyLinkLibraries(config, this->Target, deps); @@ -167,7 +171,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, if (uniqueDeps.insert(*di).second) { handleSystemIncludesDep(this->Makefile, *di, config, this->Target, - &dagChecker, result); + &dagChecker, result, excludeImported); } } } -- cgit v0.12 From f579fe0d7a102df0c69c957d48e3e728333dffe1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jan 2014 15:54:37 +0100 Subject: Help: Fix link to MAP_IMPORTED_CONFIG_ --- Help/manual/cmake-buildsystem.7.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 03f9115..2b37c0c 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -428,7 +428,7 @@ the ``CONFIG`` generator expression. The ``CONFIG`` parameter is compared case-insensitively with the configuration being built. In the presence of :prop_tgt:`IMPORTED` targets, the content of -:prop_tgt:`MAP_IMPORTED_CONFIG_DEBUG ` is also +:prop_tgt:`MAP_IMPORTED_CONFIG_DEBUG >` is also accounted for by this expression. Some buildsystems generated by :manual:`cmake(1)` have a predetermined -- cgit v0.12 From 38de54cf6f3daae70792fae1bf26b97bccc78de4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 10 Nov 2013 11:22:44 +0100 Subject: cmGeneratorTarget: Add methods to access source file groups. These methods and others will be able to get a config parameter later to implement the INTERFACE_SOURCES feature. --- Source/cmGeneratorTarget.cxx | 78 ++++++++++++++++++++++++++++++ Source/cmGeneratorTarget.h | 45 ++++++++++------- Source/cmGlobalNinjaGenerator.cxx | 8 +-- Source/cmGlobalUnixMakefileGenerator3.cxx | 8 +-- Source/cmGlobalVisualStudioGenerator.cxx | 14 +++--- Source/cmGlobalXCodeGenerator.cxx | 8 +-- Source/cmLocalVisualStudio6Generator.cxx | 4 +- Source/cmLocalVisualStudio7Generator.cxx | 4 +- Source/cmMakefileTargetGenerator.cxx | 28 +++++++---- Source/cmNinjaTargetGenerator.cxx | 34 ++++++++----- Source/cmVisualStudio10TargetGenerator.cxx | 55 +++++++++++++-------- 11 files changed, 209 insertions(+), 77 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 2c976cd..88f533c 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -103,6 +103,84 @@ static void handleSystemIncludesDep(cmMakefile *mf, const std::string &name, } //---------------------------------------------------------------------------- +void +cmGeneratorTarget::GetObjectSources(std::vector &objs) const +{ + objs = this->ObjectSources; +} + +//---------------------------------------------------------------------------- +const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file) +{ + return this->Objects[file]; +} + +void cmGeneratorTarget::AddObject(cmSourceFile *sf, std::string const&name) +{ + this->Objects[sf] = name; +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile* sf) +{ + this->ExplicitObjectName.insert(sf); +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const +{ + std::set::const_iterator it + = this->ExplicitObjectName.find(file); + return it != this->ExplicitObjectName.end(); +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GetResxSources(std::vector& srcs) const +{ + srcs = this->ResxSources; +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GetIDLSources(std::vector& srcs) const +{ + srcs = this->IDLSources; +} + +//---------------------------------------------------------------------------- +void +cmGeneratorTarget::GetHeaderSources(std::vector& srcs) const +{ + srcs = this->HeaderSources; +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GetExtraSources(std::vector& srcs) const +{ + srcs = this->ExtraSources; +} + +//---------------------------------------------------------------------------- +void +cmGeneratorTarget::GetCustomCommands(std::vector& srcs) const +{ + srcs = this->CustomCommands; +} + +//---------------------------------------------------------------------------- +void +cmGeneratorTarget::GetExpectedResxHeaders(std::set& srcs) const +{ + srcs = this->ExpectedResxHeaders; +} + +//---------------------------------------------------------------------------- +void +cmGeneratorTarget::GetExternalObjects(std::vector& srcs) const +{ + srcs = this->ExternalObjects; +} + +//---------------------------------------------------------------------------- bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, const char *config) const { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 8b760f1..4c023bf 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -32,34 +32,33 @@ public: bool GetPropertyAsBool(const char *prop) const; std::vector const& GetSourceFiles() const; + void GetObjectSources(std::vector &) const; + const std::string& GetObjectName(cmSourceFile const* file); + + void AddObject(cmSourceFile *sf, std::string const&name); + bool HasExplicitObjectName(cmSourceFile const* file) const; + void AddExplicitObjectName(cmSourceFile* sf); + + void GetResxSources(std::vector&) const; + void GetIDLSources(std::vector&) const; + void GetExternalObjects(std::vector&) const; + void GetHeaderSources(std::vector&) const; + void GetExtraSources(std::vector&) const; + void GetCustomCommands(std::vector&) const; + void GetExpectedResxHeaders(std::set&) const; + cmTarget* Target; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; cmGlobalGenerator* GlobalGenerator; - /** Sources classified by purpose. */ - std::vector CustomCommands; - std::vector ExtraSources; - std::vector HeaderSources; - std::vector ObjectSources; - std::vector ExternalObjects; - std::vector IDLSources; - std::vector ResxSources; - std::string ModuleDefinitionFile; - std::map Objects; - std::set ExplicitObjectName; - - std::set ExpectedResxHeaders; - /** Full path with trailing slash to the top-level directory holding object files for this target. Includes the build time config name placeholder if needed for the generator. */ std::string ObjectDirectory; - std::vector ObjectLibraries; - void UseObjectLibraries(std::vector& objs) const; void GetAppleArchs(const char* config, @@ -89,11 +88,23 @@ public: /** Get sources that must be built before the given source. */ std::vector const* GetSourceDepends(cmSourceFile* sf) const; +private: + friend class cmTargetTraceDependencies; struct SourceEntry { std::vector Depends; }; typedef std::map SourceEntriesType; SourceEntriesType SourceEntries; -private: + std::vector CustomCommands; + std::vector ExtraSources; + std::vector HeaderSources; + std::vector ExternalObjects; + std::vector IDLSources; + std::vector ResxSources; + std::map Objects; + std::set ExplicitObjectName; + std::set ExpectedResxHeaders; + std::vector ObjectSources; + std::vector ObjectLibraries; mutable std::map > SystemIncludesCache; cmGeneratorTarget(cmGeneratorTarget const&); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 4b92058..ec91b0f 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -644,15 +644,17 @@ void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const dir_max += "/"; gt->ObjectDirectory = dir_max; + std::vector objectSources; + gt->GetObjectSources(objectSources); // Compute the name of each object file. for(std::vector::iterator - si = gt->ObjectSources.begin(); - si != gt->ObjectSources.end(); ++si) + si = objectSources.begin(); + si != objectSources.end(); ++si) { cmSourceFile* sf = *si; std::string objectName = gt->LocalGenerator ->GetObjectFileNameWithoutTarget(*sf, dir_max); - gt->Objects[sf] = objectName; + gt->AddObject(sf, objectName); } } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 622a7c5..0b37a07 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -120,17 +120,19 @@ cmGlobalUnixMakefileGenerator3 dir_max += "/"; gt->ObjectDirectory = dir_max; + std::vector objectSources; + gt->GetObjectSources(objectSources); // Compute the name of each object file. for(std::vector::iterator - si = gt->ObjectSources.begin(); - si != gt->ObjectSources.end(); ++si) + si = objectSources.begin(); + si != objectSources.end(); ++si) { cmSourceFile* sf = *si; bool hasSourceExtension = true; std::string objectName = gt->LocalGenerator ->GetObjectFileNameWithoutTarget(*sf, dir_max, &hasSourceExtension); - gt->Objects[sf] = objectName; + gt->AddObject(sf, objectName); lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension); } } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 93a597c..42492e6 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -129,9 +129,11 @@ cmGlobalVisualStudioGenerator // Count the number of object files with each name. Note that // windows file names are not case sensitive. std::map counts; + std::vector objectSources; + gt->GetObjectSources(objectSources); for(std::vector::const_iterator - si = gt->ObjectSources.begin(); - si != gt->ObjectSources.end(); ++si) + si = objectSources.begin(); + si != objectSources.end(); ++si) { cmSourceFile* sf = *si; std::string objectNameLower = cmSystemTools::LowerCase( @@ -143,8 +145,8 @@ cmGlobalVisualStudioGenerator // For all source files producing duplicate names we need unique // object name computation. for(std::vector::const_iterator - si = gt->ObjectSources.begin(); - si != gt->ObjectSources.end(); ++si) + si = objectSources.begin(); + si != objectSources.end(); ++si) { cmSourceFile* sf = *si; std::string objectName = @@ -152,10 +154,10 @@ cmGlobalVisualStudioGenerator objectName += ".obj"; if(counts[cmSystemTools::LowerCase(objectName)] > 1) { - gt->ExplicitObjectName.insert(sf); + gt->AddExplicitObjectName(sf); objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max); } - gt->Objects[sf] = objectName; + gt->AddObject(sf, objectName); } std::string dir = gt->Makefile->GetCurrentOutputDirectory(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index eef49db..09d8124 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3925,9 +3925,11 @@ cmGlobalXCodeGenerator // to avoid exact duplicate file names. Note that Mac file names are not // typically case sensitive, hence the LowerCase. std::map counts; + std::vector objectSources; + gt->GetObjectSources(objectSources); for(std::vector::const_iterator - si = gt->ObjectSources.begin(); - si != gt->ObjectSources.end(); ++si) + si = objectSources.begin(); + si != objectSources.end(); ++si) { cmSourceFile* sf = *si; std::string objectName = @@ -3941,7 +3943,7 @@ cmGlobalXCodeGenerator // TODO: emit warning about duplicate name? } - gt->Objects[sf] = objectName; + gt->AddObject(sf, objectName); } const char* configName = this->GetCMakeCFGIntDir(); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 8eeb89a..f10216a 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -401,9 +401,9 @@ void cmLocalVisualStudio6Generator std::string compileFlags; std::vector depends; std::string objectNameDir; - if(gt->ExplicitObjectName.find(*sf) != gt->ExplicitObjectName.end()) + if(gt->HasExplicitObjectName(*sf)) { - objectNameDir = cmSystemTools::GetFilenamePath(gt->Objects[*sf]); + objectNameDir = cmSystemTools::GetFilenamePath(gt->GetObjectName(*sf)); } // Add per-source file flags. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index b645f8f..1a47ca3 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1468,9 +1468,9 @@ cmLocalVisualStudio7GeneratorFCInfo cmGeneratorTarget* gt = lg->GetGlobalGenerator()->GetGeneratorTarget(&target); std::string objectName; - if(gt->ExplicitObjectName.find(&sf) != gt->ExplicitObjectName.end()) + if(gt->HasExplicitObjectName(&sf)) { - objectName = gt->Objects[&sf]; + objectName = gt->GetObjectName(&sf); } // Compute per-source, per-config information. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f82b808..25b2b4c 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -151,9 +151,11 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() // First generate the object rule files. Save a list of all object // files for this target. + std::vector customCommands; + this->GeneratorTarget->GetCustomCommands(customCommands); for(std::vector::const_iterator - si = this->GeneratorTarget->CustomCommands.begin(); - si != this->GeneratorTarget->CustomCommands.end(); ++si) + si = customCommands.begin(); + si != customCommands.end(); ++si) { cmCustomCommand const* cc = (*si)->GetCustomCommand(); this->GenerateCustomRuleFile(*cc); @@ -170,21 +172,28 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() } } } + std::vector headerSources; + this->GeneratorTarget->GetHeaderSources(headerSources); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - this->GeneratorTarget->HeaderSources, + headerSources, this->MacOSXContentGenerator); + std::vector extraSources; + this->GeneratorTarget->GetExtraSources(extraSources); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - this->GeneratorTarget->ExtraSources, + extraSources, this->MacOSXContentGenerator); + std::vector externalObjects; + this->GeneratorTarget->GetExternalObjects(externalObjects); for(std::vector::const_iterator - si = this->GeneratorTarget->ExternalObjects.begin(); - si != this->GeneratorTarget->ExternalObjects.end(); ++si) + si = externalObjects.begin(); + si != externalObjects.end(); ++si) { this->ExternalObjects.push_back((*si)->GetFullPath()); } + std::vector objectSources; + this->GeneratorTarget->GetObjectSources(objectSources); for(std::vector::const_iterator - si = this->GeneratorTarget->ObjectSources.begin(); - si != this->GeneratorTarget->ObjectSources.end(); ++si) + si = objectSources.begin(); si != objectSources.end(); ++si) { // Generate this object file's rule file. this->WriteObjectRuleFiles(**si); @@ -421,7 +430,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) } // Get the full path name of the object file. - std::string const& objectName = this->GeneratorTarget->Objects[&source]; + std::string const& objectName = this->GeneratorTarget + ->GetObjectName(&source); std::string obj = this->LocalGenerator->GetTargetDirectory(*this->Target); obj += "/"; obj += objectName; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c8b03e1..82f8d1b 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -276,7 +276,8 @@ cmNinjaTargetGenerator std::string path = this->LocalGenerator->GetHomeRelativeOutputPath(); if(!path.empty()) path += "/"; - std::string const& objectName = this->GeneratorTarget->Objects[source]; + std::string const& objectName = this->GeneratorTarget + ->GetObjectName(source); path += this->LocalGenerator->GetTargetDirectory(*this->Target); path += "/"; path += objectName; @@ -458,28 +459,37 @@ cmNinjaTargetGenerator << this->GetTargetName() << "\n\n"; + std::vector customCommands; + this->GeneratorTarget->GetCustomCommands(customCommands); for(std::vector::const_iterator - si = this->GeneratorTarget->CustomCommands.begin(); - si != this->GeneratorTarget->CustomCommands.end(); ++si) + si = customCommands.begin(); + si != customCommands.end(); ++si) { cmCustomCommand const* cc = (*si)->GetCustomCommand(); this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget()); } + std::vector headerSources; + this->GeneratorTarget->GetHeaderSources(headerSources); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - this->GeneratorTarget->HeaderSources, + headerSources, this->MacOSXContentGenerator); + std::vector extraSources; + this->GeneratorTarget->GetExtraSources(extraSources); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - this->GeneratorTarget->ExtraSources, + extraSources, this->MacOSXContentGenerator); + std::vector externalObjects; + this->GeneratorTarget->GetExternalObjects(externalObjects); for(std::vector::const_iterator - si = this->GeneratorTarget->ExternalObjects.begin(); - si != this->GeneratorTarget->ExternalObjects.end(); ++si) + si = externalObjects.begin(); + si != externalObjects.end(); ++si) { this->Objects.push_back(this->GetSourceFilePath(*si)); } + std::vector objectSources; + this->GeneratorTarget->GetObjectSources(objectSources); for(std::vector::const_iterator - si = this->GeneratorTarget->ObjectSources.begin(); - si != this->GeneratorTarget->ObjectSources.end(); ++si) + si = objectSources.begin(); si != objectSources.end(); ++si) { this->WriteObjectBuildStatement(*si); } @@ -539,9 +549,11 @@ cmNinjaTargetGenerator } // Add order-only dependencies on custom command outputs. + std::vector customCommands; + this->GeneratorTarget->GetCustomCommands(customCommands); for(std::vector::const_iterator - si = this->GeneratorTarget->CustomCommands.begin(); - si != this->GeneratorTarget->CustomCommands.end(); ++si) + si = customCommands.begin(); + si != customCommands.end(); ++si) { cmCustomCommand const* cc = (*si)->GetCustomCommand(); const std::vector& ccoutputs = cc->GetOutputs(); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 784cadb..0a2c339 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -376,8 +376,8 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences() void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() { - std::vector const& resxObjs = - this->GeneratorTarget->ResxSources; + std::vector resxObjs; + this->GeneratorTarget->GetResxSources(resxObjs); if(!resxObjs.empty()) { this->WriteString("\n", 1); @@ -550,9 +550,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() void cmVisualStudio10TargetGenerator::WriteCustomCommands() { this->SourcesVisited.clear(); + std::vector customCommands; + this->GeneratorTarget->GetCustomCommands(customCommands); for(std::vector::const_iterator - si = this->GeneratorTarget->CustomCommands.begin(); - si != this->GeneratorTarget->CustomCommands.end(); ++si) + si = customCommands.begin(); + si != customCommands.end(); ++si) { this->WriteCustomCommand(*si); } @@ -740,8 +742,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups() this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups); } - std::vector const& resxObjs = - this->GeneratorTarget->ResxSources; + std::vector resxObjs; + this->GeneratorTarget->GetResxSources(resxObjs); if(!resxObjs.empty()) { this->WriteString("\n", 1); @@ -813,7 +815,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() this->WriteString("\n", 2); } - if(!this->GeneratorTarget->ResxSources.empty()) + if(!resxObjs.empty()) { this->WriteString("\n", 2); std::string guidName = "SG_Filter_Resource Files"; @@ -996,12 +998,18 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() } this->WriteString("\n", 1); - this->WriteSources("ClInclude", this->GeneratorTarget->HeaderSources); - this->WriteSources("Midl", this->GeneratorTarget->IDLSources); + std::vector headerSources; + this->GeneratorTarget->GetHeaderSources(headerSources); + this->WriteSources("ClInclude", headerSources); + std::vector idlSources; + this->GeneratorTarget->GetIDLSources(idlSources); + this->WriteSources("Midl", idlSources); + std::vector objectSources; + this->GeneratorTarget->GetObjectSources(objectSources); for(std::vector::const_iterator - si = this->GeneratorTarget->ObjectSources.begin(); - si != this->GeneratorTarget->ObjectSources.end(); ++si) + si = objectSources.begin(); + si != objectSources.end(); ++si) { const char* lang = (*si)->GetLanguage(); const char* tool = NULL; @@ -1038,19 +1046,21 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() } } + std::vector externalObjects; + this->GeneratorTarget->GetExternalObjects(externalObjects); if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10) { // For VS >= 11 we use LinkObjects to avoid linking custom command // outputs. Use Object for all external objects, generated or not. - this->WriteSources("Object", this->GeneratorTarget->ExternalObjects); + this->WriteSources("Object", externalObjects); } else { // If an object file is generated in this target, then vs10 will use // it in the build, and we have to list it as None instead of Object. for(std::vector::const_iterator - si = this->GeneratorTarget->ExternalObjects.begin(); - si != this->GeneratorTarget->ExternalObjects.end(); ++si) + si = externalObjects.begin(); + si != externalObjects.end(); ++si) { std::vector const* d = this->GeneratorTarget->GetSourceDepends(*si); @@ -1058,7 +1068,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() } } - this->WriteSources("None", this->GeneratorTarget->ExtraSources); + std::vector extraSources; + this->GeneratorTarget->GetExtraSources(extraSources); + this->WriteSources("None", extraSources); // Add object library contents as external objects. std::vector objs; @@ -1081,10 +1093,9 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmSourceFile& sf = *source; std::string objectName; - if(this->GeneratorTarget->ExplicitObjectName.find(&sf) - != this->GeneratorTarget->ExplicitObjectName.end()) + if(this->GeneratorTarget->HasExplicitObjectName(&sf)) { - objectName = this->GeneratorTarget->Objects[&sf]; + objectName = this->GeneratorTarget->GetObjectName(&sf); } std::string flags; std::string defines; @@ -1882,8 +1893,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() bool cmVisualStudio10TargetGenerator:: IsResxHeader(const std::string& headerFile) { - std::set::iterator it = - this->GeneratorTarget->ExpectedResxHeaders.find(headerFile); + std::set expectedResxHeaders; + this->GeneratorTarget->GetExpectedResxHeaders(expectedResxHeaders); - return it != this->GeneratorTarget->ExpectedResxHeaders.end(); + std::set::const_iterator it = + expectedResxHeaders.find(headerFile); + return it != expectedResxHeaders.end(); } -- cgit v0.12 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