From 1e0a9ac45d51e0076222026b9c44604b287a6eae Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Mar 2017 15:54:40 -0500 Subject: Refactor module definition source enumeration Add a `cmGeneratorTarget::GetModuleDefinitionSources` method. --- Source/cmGeneratorTarget.cxx | 15 ++++++++++----- Source/cmGeneratorTarget.h | 2 ++ Source/cmVisualStudio10TargetGenerator.cxx | 7 +++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 47d685d..39336b2 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -112,7 +112,7 @@ struct IDLSourcesTag struct ResxTag { }; -struct ModuleDefinitionFileTag +struct ModuleDefinitionSourcesTag { }; struct AppManifestTag @@ -236,8 +236,8 @@ struct TagVisitor } else if (!sf->GetLanguage().empty()) { DoAccept::Result>::Do(this->Data, sf); } else if (ext == "def") { - DoAccept::Result>::Do(this->Data, - sf); + DoAccept::Result>::Do( + this->Data, sf); if (this->IsObjLib) { this->BadObjLibFiles.push_back(sf); } @@ -681,6 +681,12 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const return it != this->ExplicitObjectName.end(); } +void cmGeneratorTarget::GetModuleDefinitionSources( + std::vector& data, const std::string& config) const +{ + IMPLEMENT_VISIT(ModuleDefinitionSources); +} + void cmGeneratorTarget::GetIDLSources(std::vector& data, const std::string& config) const { @@ -1942,8 +1948,7 @@ cmSourceFile const* cmGeneratorTarget::GetModuleDefinitionFile( const std::string& config) const { std::vector data; - IMPLEMENT_VISIT_IMPL(ModuleDefinitionFile, - COMMA std::vector) + this->GetModuleDefinitionSources(data, config); if (!data.empty()) { return data.front(); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index e72e0a6..ea36e16 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -77,6 +77,8 @@ public: bool HasExplicitObjectName(cmSourceFile const* file) const; void AddExplicitObjectName(cmSourceFile const* sf); + void GetModuleDefinitionSources(std::vector&, + const std::string& config) const; void GetResxSources(std::vector&, const std::string& config) const; void GetIDLSources(std::vector&, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index fbf7447..a5b1edf 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1841,10 +1841,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() (*this->BuildFileStream) << cmVS10EscapeXML(obj) << "\" />\n"; } - if (cmSourceFile const* defsrc = - this->GeneratorTarget->GetModuleDefinitionFile("")) { - this->WriteSource("None", defsrc); - } + std::vector defSources; + this->GeneratorTarget->GetModuleDefinitionSources(defSources, ""); + this->WriteSources("None", defSources); if (this->IsMissingFiles) { this->WriteMissingFiles(); -- cgit v0.12