summaryrefslogtreecommitdiff
path: root/Source/cmExtraSublimeTextGenerator.cxx
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-07-20 18:28:39 +0200
committerBrad King <brad.king@kitware.com>2016-08-03 09:43:00 -0400
commita354f60ce07cd67bd60161824a4e74bf9068fea4 (patch)
tree14c272760205567469ddd856a99e98ace6282841 /Source/cmExtraSublimeTextGenerator.cxx
parentfd59f9ad519c1c311c54569133797d9061e90558 (diff)
downloadcmake-a354f60ce07cd67bd60161824a4e74bf9068fea4.tar.gz
Refactor extra generator registration to use factories
This will allow additional information about the availability and capabilities of extra generators to be queried without actually creating them. Instead of a static NewFactory() method like the main generator factories have, use a static GetFactory() method to get a pointer to a statically allocated extra generator factory. This simplifies memory management.
Diffstat (limited to 'Source/cmExtraSublimeTextGenerator.cxx')
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx30
1 files changed, 18 insertions, 12 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index c166e26304..b6bad60dbb 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -38,24 +38,30 @@ http://www.sublimetext.com/docs/2/projects.html
http://sublimetext.info/docs/en/reference/build_systems.html
*/
-void cmExtraSublimeTextGenerator::GetDocumentation(cmDocumentationEntry& entry,
- const std::string&) const
+cmExternalMakefileProjectGeneratorFactory*
+cmExtraSublimeTextGenerator::GetFactory()
{
- entry.Name = this->GetName();
- entry.Brief = "Generates Sublime Text 2 project files.";
+ static cmExternalMakefileProjectGeneratorSimpleFactory<
+ cmExtraSublimeTextGenerator>
+ factory("Sublime Text 2", "Generates Sublime Text 2 project files.");
+
+ if (factory.GetSupportedGlobalGenerators().empty()) {
+#if defined(_WIN32)
+ factory.AddSupportedGlobalGenerator("MinGW Makefiles");
+ factory.AddSupportedGlobalGenerator("NMake Makefiles");
+// disable until somebody actually tests it:
+// factory.AddSupportedGlobalGenerator("MSYS Makefiles");
+#endif
+ factory.AddSupportedGlobalGenerator("Ninja");
+ factory.AddSupportedGlobalGenerator("Unix Makefiles");
+ }
+
+ return &factory;
}
cmExtraSublimeTextGenerator::cmExtraSublimeTextGenerator()
: cmExternalMakefileProjectGenerator()
{
-#if defined(_WIN32)
- this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
- this->SupportedGlobalGenerators.push_back("NMake Makefiles");
-// disable until somebody actually tests it:
-// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
-#endif
- this->SupportedGlobalGenerators.push_back("Ninja");
- this->SupportedGlobalGenerators.push_back("Unix Makefiles");
}
void cmExtraSublimeTextGenerator::Generate()