1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
5 #include "cmConfigure.h" // IWYU pragma: keep
11 class cmGlobalGenerator
;
14 /** \class cmExternalMakefileProjectGenerator
15 * \brief Base class for generators for "External Makefile based IDE projects".
17 * cmExternalMakefileProjectGenerator is a base class for generators
18 * for "external makefile based projects", i.e. IDE projects which work
19 * an already existing makefiles.
20 * See cmExtraEclipseCDT4Generator as an example.
21 * After the makefiles have been generated by one of the Makefile
22 * generators, the Generate() method is called and this generator
23 * can iterate over the local generators and/or projects to produce the
24 * project files for the IDE.
26 class cmExternalMakefileProjectGenerator
29 virtual ~cmExternalMakefileProjectGenerator() = default;
31 virtual void EnableLanguage(std::vector
<std::string
> const& languages
,
32 cmMakefile
*, bool optional
);
34 //! set the global generator which will generate the makefiles
35 virtual void SetGlobalGenerator(cmGlobalGenerator
* generator
)
37 this->GlobalGenerator
= generator
;
40 //! Return the list of global generators supported by this extra generator
41 const std::vector
<std::string
>& GetSupportedGlobalGenerators() const
43 return this->SupportedGlobalGenerators
;
46 /** Create a full name from the given global generator name and the
47 * extra generator name
49 static std::string
CreateFullGeneratorName(
50 const std::string
& globalGenerator
, const std::string
& extraGenerator
);
52 //! Generate the project files, the Makefiles have already been generated
53 virtual void Generate() = 0;
55 void SetName(const std::string
& n
) { this->Name
= n
; }
56 std::string
GetName() const { return this->Name
; }
58 virtual bool Open(const std::string
& bindir
, const std::string
& projectName
,
62 //! Contains the names of the global generators support by this generator.
63 std::vector
<std::string
> SupportedGlobalGenerators
;
64 //! the global generator which creates the makefiles
65 const cmGlobalGenerator
* GlobalGenerator
= nullptr;
70 class cmExternalMakefileProjectGeneratorFactory
73 cmExternalMakefileProjectGeneratorFactory(std::string n
, std::string doc
);
74 virtual ~cmExternalMakefileProjectGeneratorFactory();
76 std::string
GetName() const;
77 std::string
GetDocumentation() const;
78 std::vector
<std::string
> GetSupportedGlobalGenerators() const;
79 std::vector
<std::string
> Aliases
;
81 virtual std::unique_ptr
<cmExternalMakefileProjectGenerator
>
82 CreateExternalMakefileProjectGenerator() const = 0;
84 void AddSupportedGlobalGenerator(const std::string
& base
);
88 std::string Documentation
;
89 std::vector
<std::string
> SupportedGlobalGenerators
;
93 class cmExternalMakefileProjectGeneratorSimpleFactory
94 : public cmExternalMakefileProjectGeneratorFactory
97 cmExternalMakefileProjectGeneratorSimpleFactory(const std::string
& n
,
98 const std::string
& doc
)
99 : cmExternalMakefileProjectGeneratorFactory(n
, doc
)
103 std::unique_ptr
<cmExternalMakefileProjectGenerator
>
104 CreateExternalMakefileProjectGenerator() const override
106 std::unique_ptr
<cmExternalMakefileProjectGenerator
> p(new T
);
107 p
->SetName(this->GetName());