diff options
author | Artur Ryt <artur.ryt@gmail.com> | 2018-11-30 18:00:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-18 17:57:32 (GMT) |
commit | 7408cd39298dfce442d7aa539a90a227433865d5 (patch) | |
tree | 1910148c8048133dc1ff4c557d070c17940cbe9b /Source/cmake.cxx | |
parent | a61c061b6143cb6d8920b1b5796a867c0f104556 (diff) | |
download | CMake-7408cd39298dfce442d7aa539a90a227433865d5.zip CMake-7408cd39298dfce442d7aa539a90a227433865d5.tar.gz CMake-7408cd39298dfce442d7aa539a90a227433865d5.tar.bz2 |
cmake: Return generator docs directly
The GetGeneratorDocumentation() function was not accurately
named and required the vector to populate to be passed as a
function argument. This commit makes the slightly renamed
function return by value, making it a true getter as implied
by its name. Some minor refactoring of the implementation
also makes the steps of populating the vector clearer.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9fcfbde..c53b597 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1924,13 +1924,19 @@ void cmake::SetIsInTryCompile(bool b) this->State->SetIsInTryCompile(b); } -void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) +void cmake::AppendGlobalGeneratorsDocumentation( + std::vector<cmDocumentationEntry>& v) { for (cmGlobalGeneratorFactory* g : this->Generators) { cmDocumentationEntry e; g->GetDocumentation(e); v.push_back(std::move(e)); } +} + +void cmake::AppendExtraGeneratorsDocumentation( + std::vector<cmDocumentationEntry>& v) +{ for (cmExternalMakefileProjectGeneratorFactory* eg : this->ExtraGenerators) { const std::string doc = eg->GetDocumentation(); const std::string name = eg->GetName(); @@ -1956,12 +1962,19 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) } } +std::vector<cmDocumentationEntry> cmake::GetGeneratorsDocumentation() +{ + std::vector<cmDocumentationEntry> v; + this->AppendGlobalGeneratorsDocumentation(v); + this->AppendExtraGeneratorsDocumentation(v); + return v; +} + void cmake::PrintGeneratorList() { #ifdef CMAKE_BUILD_WITH_CMAKE cmDocumentation doc; - std::vector<cmDocumentationEntry> generators; - this->GetGeneratorDocumentation(generators); + auto generators = this->GetGeneratorsDocumentation(); doc.AppendSection("Generators", generators); std::cerr << "\n"; doc.PrintDocumentation(cmDocumentation::ListGenerators, std::cerr); |