Add cmGlobalGeneratorFactory::GetGenerators()

This allows cmGlobalGeneratorFactory to create more than
one type of cmGlobalGenerator in a next step.
This commit is contained in:
Patrick Gansterer 2012-11-19 15:52:46 +01:00 committed by Brad King
parent e8f841473b
commit 30a695021c
3 changed files with 11 additions and 1 deletions

View File

@ -33,6 +33,9 @@ public:
/** Get the documentation entry for this factory */ /** Get the documentation entry for this factory */
virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0; virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
/** Get the names of the current registered generators */
virtual void GetGenerators(std::vector<std::string>& names) const = 0;
}; };
template<class T> template<class T>
@ -46,6 +49,10 @@ public:
/** Get the documentation entry for this factory */ /** Get the documentation entry for this factory */
virtual void GetDocumentation(cmDocumentationEntry& entry) const { virtual void GetDocumentation(cmDocumentationEntry& entry) const {
T().GetDocumentation(entry); } T().GetDocumentation(entry); }
/** Get the names of the current registered generators */
virtual void GetGenerators(std::vector<std::string>& names) const {
names.push_back(T::GetActualName()); }
}; };
#endif #endif

View File

@ -120,6 +120,9 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry) const { virtual void GetDocumentation(cmDocumentationEntry& entry) const {
cmGlobalXCodeGenerator().GetDocumentation(entry); } cmGlobalXCodeGenerator().GetDocumentation(entry); }
virtual void GetGenerators(std::vector<std::string>& names) const {
names.push_back(cmGlobalXCodeGenerator::GetActualName()); }
}; };
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -1877,7 +1877,7 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin(); for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin();
i != this->Generators.end(); ++i) i != this->Generators.end(); ++i)
{ {
names.push_back(i->first); i->second->GetGenerators(names);
} }
for(RegisteredExtraGeneratorsMap::const_iterator for(RegisteredExtraGeneratorsMap::const_iterator
i = this->ExtraGenerators.begin(); i = this->ExtraGenerators.begin();