diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2022-10-26 11:09:54 (GMT) |
---|---|---|
committer | Alex Turbov <i.zaufi@gmail.com> | 2022-11-17 12:37:13 (GMT) |
commit | 6e3e8827faf0bf2363ecf9035b5573e715e52fb2 (patch) | |
tree | 21681997c33a843eb61cd66d76651b5a3b4f220c | |
parent | e99a4acbcd2f7ec8e5cefbf996af1dfa95e61a27 (diff) | |
download | CMake-6e3e8827faf0bf2363ecf9035b5573e715e52fb2.zip CMake-6e3e8827faf0bf2363ecf9035b5573e715e52fb2.tar.gz CMake-6e3e8827faf0bf2363ecf9035b5573e715e52fb2.tar.bz2 |
Refactor: `cmGlobalGeneratorFactory::GetDocumentation` returns entry
Before, a documentation entry was in/out parameter.
Now it's a normal return value.
This also makes possible to eliminate defaulted default ctor
for `cmDocumentationEntry` for C++ 11.
Also, simplify `cmake::AppendGlobalGeneratorsDocumentation()`.
28 files changed, 91 insertions, 124 deletions
diff --git a/Source/cmDocumentationEntry.h b/Source/cmDocumentationEntry.h index c66b21e..d971836 100644 --- a/Source/cmDocumentationEntry.h +++ b/Source/cmDocumentationEntry.h @@ -10,7 +10,6 @@ struct cmDocumentationEntry { #if __cplusplus <= 201103L - cmDocumentationEntry() = default; cmDocumentationEntry(const std::string& name, const std::string& brief) : Name{ name } , Brief{ brief } diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 776ee40..2fd7f8a 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -60,11 +60,10 @@ cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(cmMakefile* mf) return std::unique_ptr<cmLocalGenerator>(std::move(lg)); } -void cmGlobalBorlandMakefileGenerator::GetDocumentation( - cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalBorlandMakefileGenerator::GetDocumentation() { - entry.Name = cmGlobalBorlandMakefileGenerator::GetActualName(); - entry.Brief = "Generates Borland makefiles."; + return { cmGlobalBorlandMakefileGenerator::GetActualName(), + "Generates Borland makefiles." }; } std::vector<cmGlobalGenerator::GeneratedMakeCommand> diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index a280b81..049d6ba 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -13,7 +13,6 @@ class cmLocalGenerator; class cmMakefile; class cmake; -struct cmDocumentationEntry; /** \class cmGlobalBorlandMakefileGenerator * \brief Write a Borland makefiles. @@ -38,7 +37,7 @@ public: static std::string GetActualName() { return "Borland Makefiles"; } /** Get the documentation entry for this generator. */ - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); //! Create a local generator appropriate to this Global Generator std::unique_ptr<cmLocalGenerator> CreateLocalGenerator( diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index e8ed3e0..a935079 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -4,6 +4,10 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include "cmDocumentationEntry.h" // IWYU pragma: export + +// TODO The following headers are parts of the `cmGlobalGeneratorFactory` +// public API, so could be defined as export to IWYU #include <string> #include <vector> @@ -11,7 +15,6 @@ class cmGlobalGenerator; class cmake; -struct cmDocumentationEntry; /** \class cmGlobalGeneratorFactory * \brief Responable for creating cmGlobalGenerator instances @@ -28,7 +31,7 @@ public: const std::string& n, bool allowArch, cmake* cm) const = 0; /** Get the documentation entry for this factory */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0; + virtual cmDocumentationEntry GetDocumentation() const = 0; /** Get the names of the current registered generators */ virtual std::vector<std::string> GetGeneratorNames() const = 0; @@ -62,9 +65,9 @@ public: } /** Get the documentation entry for this factory */ - void GetDocumentation(cmDocumentationEntry& entry) const override + cmDocumentationEntry GetDocumentation() const override { - T::GetDocumentation(entry); + return T::GetDocumentation(); } /** Get the names of the current registered generators */ diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 9c334a5..18c48d7 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -15,7 +15,6 @@ #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" -#include "cmDocumentationEntry.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" #include "cmGhsMultiGpj.h" @@ -58,11 +57,12 @@ cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmMakefile* mf) cm::make_unique<cmLocalGhsMultiGenerator>(this, mf)); } -void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalGhsMultiGenerator::GetDocumentation() { - entry.Name = GetActualName(); - entry.Brief = - "Generates Green Hills MULTI files (experimental, work-in-progress)."; + return { + GetActualName(), + "Generates Green Hills MULTI files (experimental, work-in-progress)." + }; } void cmGlobalGhsMultiGenerator::ComputeTargetObjectDirectory( diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index aa68d3b..4a79610 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -18,7 +18,6 @@ class cmGeneratorTarget; class cmLocalGenerator; class cmMakefile; class cmake; -struct cmDocumentationEntry; class cmGlobalGhsMultiGenerator : public cmGlobalGenerator { @@ -46,7 +45,7 @@ public: std::string GetName() const override { return GetActualName(); } /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); /** * Utilized by the generator factory to determine if this generator diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 1a625cc..f1d4d09 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -6,7 +6,6 @@ #include <cmext/algorithm> -#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmState.h" @@ -36,11 +35,10 @@ void cmGlobalJOMMakefileGenerator::EnableLanguage( this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } -void cmGlobalJOMMakefileGenerator::GetDocumentation( - cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalJOMMakefileGenerator::GetDocumentation() { - entry.Name = cmGlobalJOMMakefileGenerator::GetActualName(); - entry.Brief = "Generates JOM makefiles."; + return { cmGlobalJOMMakefileGenerator::GetActualName(), + "Generates JOM makefiles." }; } void cmGlobalJOMMakefileGenerator::PrintCompilerAdvice(std::ostream& os, diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 332d1cf..5e74875 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -13,7 +13,6 @@ class cmMakefile; class cmake; -struct cmDocumentationEntry; /** \class cmGlobalJOMMakefileGenerator * \brief Write a JOM makefiles. @@ -39,7 +38,7 @@ public: static std::string GetActualName() { return "NMake Makefiles JOM"; } /** Get the documentation entry for this generator. */ - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index d4ff1e0..e543aea 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -4,7 +4,6 @@ #include "cmsys/FStream.hxx" -#include "cmDocumentationEntry.h" #include "cmMakefile.h" #include "cmState.h" #include "cmStringAlgorithms.h" @@ -53,9 +52,8 @@ void cmGlobalMSYSMakefileGenerator::EnableLanguage( } } -void cmGlobalMSYSMakefileGenerator::GetDocumentation( - cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalMSYSMakefileGenerator::GetDocumentation() { - entry.Name = cmGlobalMSYSMakefileGenerator::GetActualName(); - entry.Brief = "Generates MSYS makefiles."; + return { cmGlobalMSYSMakefileGenerator::GetActualName(), + "Generates MSYS makefiles." }; } diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index 586487f..a8516a4 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -11,7 +11,6 @@ class cmMakefile; class cmake; -struct cmDocumentationEntry; /** \class cmGlobalMSYSMakefileGenerator * \brief Write a NMake makefiles. @@ -36,7 +35,7 @@ public: static std::string GetActualName() { return "MSYS Makefiles"; } /** Get the documentation entry for this generator. */ - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index 5a7edae..a0a52d3 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGlobalMinGWMakefileGenerator.h" -#include "cmDocumentationEntry.h" #include "cmMakefile.h" #include "cmState.h" #include "cmSystemTools.h" @@ -19,9 +18,8 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm) cm->GetState()->SetMinGWMake(true); } -void cmGlobalMinGWMakefileGenerator::GetDocumentation( - cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalMinGWMakefileGenerator::GetDocumentation() { - entry.Name = cmGlobalMinGWMakefileGenerator::GetActualName(); - entry.Brief = "Generates a make file for use with mingw32-make."; + return { cmGlobalMinGWMakefileGenerator::GetActualName(), + "Generates a make file for use with mingw32-make." }; } diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index 92d495c..b39db03 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -11,7 +11,6 @@ class cmMakefile; class cmake; -struct cmDocumentationEntry; /** \class cmGlobalMinGWMakefileGenerator * \brief Write a NMake makefiles. @@ -35,5 +34,5 @@ public: static std::string GetActualName() { return "MinGW Makefiles"; } /** Get the documentation entry for this generator. */ - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); }; diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index eabacf6..cb53850 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -8,7 +8,6 @@ #include "cmsys/RegularExpression.hxx" -#include "cmDocumentationEntry.h" #include "cmDuration.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" @@ -80,11 +79,10 @@ void cmGlobalNMakeMakefileGenerator::CheckNMakeFeatures() cmSystemTools::OP_LESS, this->NMakeVersion, "9"); } -void cmGlobalNMakeMakefileGenerator::GetDocumentation( - cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalNMakeMakefileGenerator::GetDocumentation() { - entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName(); - entry.Brief = "Generates NMake makefiles."; + return { cmGlobalNMakeMakefileGenerator::GetActualName(), + "Generates NMake makefiles." }; } void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice( @@ -128,12 +126,8 @@ void cmGlobalNMakeMakefileGenerator::PrintBuildCommandAdvice(std::ostream& os, if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { // nmake does not support parallel build level // see https://msdn.microsoft.com/en-us/library/afyyse50.aspx - - /* clang-format off */ - os << - "Warning: NMake does not support parallel builds. " - "Ignoring parallel build command line option.\n"; - /* clang-format on */ + os << "Warning: NMake does not support parallel builds. " + "Ignoring parallel build command line option.\n"; } this->cmGlobalUnixMakefileGenerator3::PrintBuildCommandAdvice( diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index b3574eb..436ebca 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -15,7 +15,6 @@ class cmMakefile; class cmake; -struct cmDocumentationEntry; /** \class cmGlobalNMakeMakefileGenerator * \brief Write a NMake makefiles. @@ -45,7 +44,7 @@ public: } /** Get the documentation entry for this generator. */ - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 395372b..aa1ded0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -25,7 +25,6 @@ #include "cmsys/FStream.hxx" #include "cmCxxModuleMapper.h" -#include "cmDocumentationEntry.h" #include "cmFileSet.h" #include "cmFortranParser.h" #include "cmGeneratedFileStream.h" @@ -554,10 +553,10 @@ codecvt::Encoding cmGlobalNinjaGenerator::GetMakefileEncoding() const return this->NinjaExpectedEncoding; } -void cmGlobalNinjaGenerator::GetDocumentation(cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalNinjaGenerator::GetDocumentation() { - entry.Name = cmGlobalNinjaGenerator::GetActualName(); - entry.Brief = "Generates build.ninja files."; + return { cmGlobalNinjaGenerator::GetActualName(), + "Generates build.ninja files." }; } // Implemented in all cmGlobaleGenerator sub-classes. @@ -3211,10 +3210,10 @@ cmGlobalNinjaMultiGenerator::cmGlobalNinjaMultiGenerator(cmake* cm) cm->GetState()->SetNinjaMulti(true); } -void cmGlobalNinjaMultiGenerator::GetDocumentation(cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalNinjaMultiGenerator::GetDocumentation() { - entry.Name = cmGlobalNinjaMultiGenerator::GetActualName(); - entry.Brief = "Generates build-<Config>.ninja files."; + return { cmGlobalNinjaMultiGenerator::GetActualName(), + "Generates build-<Config>.ninja files." }; } std::string cmGlobalNinjaMultiGenerator::ExpandCFGIntDir( diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index dac1c52..1628349 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -35,7 +35,6 @@ class cmMakefile; class cmOutputConverter; class cmStateDirectory; class cmake; -struct cmDocumentationEntry; /** * \class cmGlobalNinjaGenerator @@ -193,7 +192,7 @@ public: /** Get encoding used by generator for ninja files */ codecvt::Encoding GetMakefileEncoding() const override; - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); void EnableLanguage(std::vector<std::string> const& languages, cmMakefile* mf, bool optional) override; @@ -656,7 +655,7 @@ public: new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaMultiGenerator>()); } - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); std::string GetName() const override { diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index bf9e40e..70a9d3e 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -11,7 +11,6 @@ #include <cmext/algorithm> #include <cmext/memory> -#include "cmDocumentationEntry.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" @@ -71,11 +70,10 @@ cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmMakefile* mf) cm::make_unique<cmLocalUnixMakefileGenerator3>(this, mf)); } -void cmGlobalUnixMakefileGenerator3::GetDocumentation( - cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalUnixMakefileGenerator3::GetDocumentation() { - entry.Name = cmGlobalUnixMakefileGenerator3::GetActualName(); - entry.Brief = "Generates standard UNIX makefiles."; + return { cmGlobalUnixMakefileGenerator3::GetActualName(), + "Generates standard UNIX makefiles." }; } void cmGlobalUnixMakefileGenerator3::ComputeTargetObjectDirectory( diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 92e567a..214ba2a 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -24,7 +24,6 @@ class cmLocalUnixMakefileGenerator3; class cmMakefile; class cmMakefileTargetGenerator; class cmake; -struct cmDocumentationEntry; /** \class cmGlobalUnixMakefileGenerator3 * \brief Write a Unix makefiles. @@ -101,7 +100,7 @@ public: bool SupportsCustomCommandDepfile() const override { return true; } /** Get the documentation entry for this generator. */ - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); std::unique_ptr<cmLocalGenerator> CreateLocalGenerator( cmMakefile* mf) override; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index c53ddf5..75e3df8 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -7,7 +7,6 @@ #include <utility> #include <vector> -#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmGlobalGeneratorFactory.h" #include "cmGlobalVisualStudioGenerator.h" @@ -74,11 +73,11 @@ public: return std::unique_ptr<cmGlobalGenerator>(std::move(ret)); } - void GetDocumentation(cmDocumentationEntry& entry) const override + cmDocumentationEntry GetDocumentation() const override { - entry.Name = std::string(vs11generatorName) + " [arch]"; - entry.Brief = "Deprecated. Generates Visual Studio 2012 project files. " - "Optional [arch] can be \"Win64\" or \"ARM\"."; + return { std::string(vs11generatorName) + " [arch]", + "Deprecated. Generates Visual Studio 2012 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"." }; } std::vector<std::string> GetGeneratorNames() const override diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 600ee0a..7e56a78 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -6,7 +6,6 @@ #include <sstream> #include <vector> -#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmGlobalGeneratorFactory.h" #include "cmGlobalVisualStudioGenerator.h" @@ -62,11 +61,11 @@ public: return std::unique_ptr<cmGlobalGenerator>(); } - void GetDocumentation(cmDocumentationEntry& entry) const override + cmDocumentationEntry GetDocumentation() const override { - entry.Name = std::string(vs12generatorName) + " [arch]"; - entry.Brief = "Generates Visual Studio 2013 project files. " - "Optional [arch] can be \"Win64\" or \"ARM\"."; + return { std::string(vs12generatorName) + " [arch]", + "Generates Visual Studio 2013 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"." }; } std::vector<std::string> GetGeneratorNames() const override diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 9f94cca..0e05083 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -7,7 +7,6 @@ #include <cm/vector> -#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmGlobalGeneratorFactory.h" #include "cmGlobalVisualStudioGenerator.h" @@ -64,11 +63,11 @@ public: return std::unique_ptr<cmGlobalGenerator>(); } - void GetDocumentation(cmDocumentationEntry& entry) const override + cmDocumentationEntry GetDocumentation() const override { - entry.Name = std::string(vs14generatorName) + " [arch]"; - entry.Brief = "Generates Visual Studio 2015 project files. " - "Optional [arch] can be \"Win64\" or \"ARM\"."; + return { std::string(vs14generatorName) + " [arch]", + "Generates Visual Studio 2015 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"." }; } std::vector<std::string> GetGeneratorNames() const override diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index e03e665..cd0b114 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -6,7 +6,6 @@ #include <utility> #include <vector> -#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmGlobalGeneratorFactory.h" #include "cmGlobalVisualStudioGenerator.h" @@ -62,11 +61,11 @@ public: return std::unique_ptr<cmGlobalGenerator>(std::move(ret)); } - void GetDocumentation(cmDocumentationEntry& entry) const override + cmDocumentationEntry GetDocumentation() const override { - entry.Name = std::string(vs9generatorName) + " [arch]"; - entry.Brief = "Generates Visual Studio 2008 project files. " - "Optional [arch] can be \"Win64\" or \"IA64\"."; + return { std::string(vs9generatorName) + " [arch]", + "Generates Visual Studio 2008 project files. " + "Optional [arch] can be \"Win64\" or \"IA64\"." }; } std::vector<std::string> GetGeneratorNames() const override diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index be318c1..ee24f05 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -14,7 +14,6 @@ #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" -#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmGlobalGeneratorFactory.h" #include "cmMakefile.h" @@ -255,11 +254,11 @@ public: return std::unique_ptr<cmGlobalGenerator>(); } - void GetDocumentation(cmDocumentationEntry& entry) const override + cmDocumentationEntry GetDocumentation() const override { - entry.Name = std::string(vs15generatorName) + " [arch]"; - entry.Brief = "Generates Visual Studio 2017 project files. " - "Optional [arch] can be \"Win64\" or \"ARM\"."; + return { std::string(vs15generatorName) + " [arch]", + "Generates Visual Studio 2017 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"." }; } std::vector<std::string> GetGeneratorNames() const override @@ -351,11 +350,11 @@ public: return std::unique_ptr<cmGlobalGenerator>(); } - void GetDocumentation(cmDocumentationEntry& entry) const override + cmDocumentationEntry GetDocumentation() const override { - entry.Name = std::string(vs16generatorName); - entry.Brief = "Generates Visual Studio 2019 project files. " - "Use -A option to specify architecture."; + return { std::string(vs16generatorName), + "Generates Visual Studio 2019 project files. " + "Use -A option to specify architecture." }; } std::vector<std::string> GetGeneratorNames() const override @@ -416,11 +415,11 @@ public: return std::unique_ptr<cmGlobalGenerator>(); } - void GetDocumentation(cmDocumentationEntry& entry) const override + cmDocumentationEntry GetDocumentation() const override { - entry.Name = std::string(vs17generatorName); - entry.Brief = "Generates Visual Studio 2022 project files. " - "Use -A option to specify architecture."; + return { std::string(vs17generatorName), + "Generates Visual Studio 2022 project files. " + "Use -A option to specify architecture." }; } std::vector<std::string> GetGeneratorNames() const override diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index fb2a8b6..ed44e6b 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -4,7 +4,6 @@ #include <ostream> -#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmState.h" @@ -54,11 +53,10 @@ bool cmGlobalWatcomWMakeGenerator::SetSystemName(std::string const& s, return this->cmGlobalUnixMakefileGenerator3::SetSystemName(s, mf); } -void cmGlobalWatcomWMakeGenerator::GetDocumentation( - cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalWatcomWMakeGenerator::GetDocumentation() { - entry.Name = cmGlobalWatcomWMakeGenerator::GetActualName(); - entry.Brief = "Generates Watcom WMake makefiles."; + return { cmGlobalWatcomWMakeGenerator::GetActualName(), + "Generates Watcom WMake makefiles." }; } std::vector<cmGlobalGenerator::GeneratedMakeCommand> diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index eb93934..5579120 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -15,7 +15,6 @@ class cmMakefile; class cmake; -struct cmDocumentationEntry; /** \class cmGlobalWatcomWMakeGenerator * \brief Write a NMake makefiles. @@ -39,7 +38,7 @@ public: static std::string GetActualName() { return "Watcom WMake"; } /** Get the documentation entry for this generator. */ - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); /** Tell the generator about the target system. */ bool SetSystemName(std::string const& s, cmMakefile* mf) override; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 62e5a1e..0e94de5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -24,7 +24,6 @@ #include "cmCustomCommandGenerator.h" #include "cmCustomCommandLines.h" #include "cmCustomCommandTypes.h" -#include "cmDocumentationEntry.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" @@ -149,9 +148,9 @@ public: std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator( const std::string& name, bool allowArch, cmake* cm) const override; - void GetDocumentation(cmDocumentationEntry& entry) const override + cmDocumentationEntry GetDocumentation() const override { - cmGlobalXCodeGenerator::GetDocumentation(entry); + return cmGlobalXCodeGenerator::GetDocumentation(); } std::vector<std::string> GetGeneratorNames() const override @@ -4864,10 +4863,10 @@ std::string cmGlobalXCodeGenerator::ExpandCFGIntDir( return tmp; } -void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry) +cmDocumentationEntry cmGlobalXCodeGenerator::GetDocumentation() { - entry.Name = cmGlobalXCodeGenerator::GetActualName(); - entry.Brief = "Generate Xcode project files."; + return { cmGlobalXCodeGenerator::GetActualName(), + "Generate Xcode project files." }; } std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake( diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 9ae75fb..856852b 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -14,6 +14,7 @@ #include <cm/optional> #include <cm/string_view> +#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmTransformDepfile.h" #include "cmValue.h" @@ -28,7 +29,6 @@ class cmMakefile; class cmSourceFile; class cmSourceGroup; class cmake; -struct cmDocumentationEntry; /** \class cmGlobalXCodeGenerator * \brief Write a Unix makefiles. @@ -54,7 +54,7 @@ public: static std::string GetActualName() { return "Xcode"; } /** Get the documentation entry for this generator. */ - static void GetDocumentation(cmDocumentationEntry& entry); + static cmDocumentationEntry GetDocumentation(); //! Create a local generator appropriate to this Global Generator std::unique_ptr<cmLocalGenerator> CreateLocalGenerator( diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 62f926e..befcb55 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2949,17 +2949,15 @@ void cmake::AppendGlobalGeneratorsDocumentation( std::vector<cmDocumentationEntry>& v) { const auto defaultGenerator = this->EvaluateDefaultGlobalGenerator(); - const std::string defaultName = defaultGenerator->GetName(); - bool foundDefaultOne = false; + const auto defaultName = defaultGenerator->GetName(); + auto foundDefaultOne = false; for (const auto& g : this->Generators) { - cmDocumentationEntry e; - g->GetDocumentation(e); - if (!foundDefaultOne && cmHasPrefix(e.Name, defaultName)) { - e.CustomNamePrefix = '*'; + v.emplace_back(g->GetDocumentation()); + if (!foundDefaultOne && cmHasPrefix(v.back().Name, defaultName)) { + v.back().CustomNamePrefix = '*'; foundDefaultOne = true; } - v.push_back(std::move(e)); } } |