diff options
Diffstat (limited to 'Source/cmExternalMakefileProjectGenerator.h')
-rw-r--r-- | Source/cmExternalMakefileProjectGenerator.h | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index 5d4d54d..6ae5533 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -35,11 +35,6 @@ class cmExternalMakefileProjectGenerator public: virtual ~cmExternalMakefileProjectGenerator() {} - ///! Get the name for this generator. - virtual std::string GetName() const = 0; - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry, - const std::string& fullName) const = 0; virtual void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*, bool optional); @@ -55,8 +50,6 @@ public: return this->SupportedGlobalGenerators; } - ///! Get the name of the global generator for the given full name - std::string GetGlobalGeneratorName(const std::string& fullName); /** Create a full name from the given global generator name and the * extra generator name */ @@ -66,11 +59,59 @@ public: ///! Generate the project files, the Makefiles have already been generated virtual void Generate() = 0; + void SetName(const std::string& n) { Name = n; } + std::string GetName() const { return Name; } + protected: ///! Contains the names of the global generators support by this generator. std::vector<std::string> SupportedGlobalGenerators; ///! the global generator which creates the makefiles const cmGlobalGenerator* GlobalGenerator; + + std::string Name; +}; + +class cmExternalMakefileProjectGeneratorFactory +{ +public: + cmExternalMakefileProjectGeneratorFactory(const std::string& n, + const std::string& doc); + virtual ~cmExternalMakefileProjectGeneratorFactory(); + + std::string GetName() const; + std::string GetDocumentation() const; + std::vector<std::string> GetSupportedGlobalGenerators() const; + std::vector<std::string> Aliases; + + virtual cmExternalMakefileProjectGenerator* + CreateExternalMakefileProjectGenerator() const = 0; + + void AddSupportedGlobalGenerator(const std::string& base); + +private: + std::string Name; + std::string Documentation; + std::vector<std::string> SupportedGlobalGenerators; +}; + +template <class T> +class cmExternalMakefileProjectGeneratorSimpleFactory + : public cmExternalMakefileProjectGeneratorFactory +{ +public: + cmExternalMakefileProjectGeneratorSimpleFactory(const std::string& n, + const std::string& doc) + : cmExternalMakefileProjectGeneratorFactory(n, doc) + { + } + + cmExternalMakefileProjectGenerator* CreateExternalMakefileProjectGenerator() + const + { + T* p = new T; + p->SetName(GetName()); + return p; + } }; #endif |