summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CMakeLists.txt1
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h5
-rw-r--r--Source/cmGlobalGeneratorFactory.h51
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.h5
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.h5
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.h5
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h5
-rw-r--r--Source/cmGlobalNinjaGenerator.h5
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h6
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio10IA64Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio11ARMGenerator.h5
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio11Win64Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h6
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h6
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio8Win64Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio9Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio9IA64Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio9Win64Generator.h5
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.h4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx19
-rw-r--r--Source/cmGlobalXCodeGenerator.h4
-rw-r--r--Source/cmake.cxx57
-rw-r--r--Source/cmake.h5
28 files changed, 174 insertions, 75 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 8bf6c40..7bf1678 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -201,6 +201,7 @@ set(SRCS
cmGeneratorTarget.h
cmGlobalGenerator.cxx
cmGlobalGenerator.h
+ cmGlobalGeneratorFactory.h
cmGlobalUnixMakefileGenerator3.cxx
cmGlobalUnixMakefileGenerator3.h
cmGraphAdjacencyList.h
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index c0cb8a6..40bdcb0 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -23,8 +23,9 @@ class cmGlobalBorlandMakefileGenerator : public cmGlobalNMakeMakefileGenerator
{
public:
cmGlobalBorlandMakefileGenerator();
- static cmGlobalGenerator* New()
- { return new cmGlobalBorlandMakefileGenerator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalBorlandMakefileGenerator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
new file mode 100644
index 0000000..05c8420
--- /dev/null
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -0,0 +1,51 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef cmGlobalGeneratorFactory_h
+#define cmGlobalGeneratorFactory_h
+
+#include "cmStandardIncludes.h"
+
+class cmGlobalGenerator;
+struct cmDocumentationEntry;
+
+/** \class cmGlobalGeneratorFactory
+ * \brief Responable for creating cmGlobalGenerator instances
+ *
+ * Subclasses of this class generate instances of cmGlobalGenerator.
+ */
+class cmGlobalGeneratorFactory
+{
+public:
+ virtual ~cmGlobalGeneratorFactory() {}
+
+ /** Create a GlobalGenerator */
+ virtual cmGlobalGenerator* CreateGlobalGenerator() const = 0;
+
+ /** Get the documentation entry for this factory */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
+};
+
+template<class T>
+class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
+{
+public:
+ /** Create a GlobalGenerator */
+ virtual cmGlobalGenerator* CreateGlobalGenerator() const {
+ return new T; }
+
+ /** Get the documentation entry for this factory */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const {
+ T().GetDocumentation(entry); }
+};
+
+#endif
diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h
index 691ebdb..8686fbf 100644
--- a/Source/cmGlobalJOMMakefileGenerator.h
+++ b/Source/cmGlobalJOMMakefileGenerator.h
@@ -23,8 +23,9 @@ class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalJOMMakefileGenerator();
- static cmGlobalGenerator* New() {
- return new cmGlobalJOMMakefileGenerator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalJOMMakefileGenerator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
return cmGlobalJOMMakefileGenerator::GetActualName();}
diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h
index b76a5bf..17decf2 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.h
+++ b/Source/cmGlobalMSYSMakefileGenerator.h
@@ -23,8 +23,9 @@ class cmGlobalMSYSMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalMSYSMakefileGenerator();
- static cmGlobalGenerator* New() {
- return new cmGlobalMSYSMakefileGenerator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalMSYSMakefileGenerator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h
index 9a6a513..54a6f5b 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.h
+++ b/Source/cmGlobalMinGWMakefileGenerator.h
@@ -23,8 +23,9 @@ class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalMinGWMakefileGenerator();
- static cmGlobalGenerator* New() {
- return new cmGlobalMinGWMakefileGenerator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalMinGWMakefileGenerator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
return cmGlobalMinGWMakefileGenerator::GetActualName();}
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index de33b8f..183ea9e 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -23,8 +23,9 @@ class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalNMakeMakefileGenerator();
- static cmGlobalGenerator* New() {
- return new cmGlobalNMakeMakefileGenerator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalNMakeMakefileGenerator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
return cmGlobalNMakeMakefileGenerator::GetActualName();}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 24c3916..7e1f6e3 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -14,6 +14,7 @@
# define cmGlobalNinjaGenerator_h
# include "cmGlobalGenerator.h"
+# include "cmGlobalGeneratorFactory.h"
# include "cmNinjaTypes.h"
//#define NINJA_GEN_VERBOSE_FILES
@@ -160,8 +161,8 @@ public:
cmGlobalNinjaGenerator();
/// Convenience method for creating an instance of this class.
- static cmGlobalGenerator* New() {
- return new cmGlobalNinjaGenerator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>(); }
/// Destructor.
virtual ~cmGlobalNinjaGenerator() { }
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index e6dd09d..914820c 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -13,6 +13,7 @@
#define cmGlobalUnixMakefileGenerator3_h
#include "cmGlobalGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
class cmGeneratedFileStream;
class cmMakefileTargetGenerator;
@@ -54,8 +55,9 @@ class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator
{
public:
cmGlobalUnixMakefileGenerator3();
- static cmGlobalGenerator* New() {
- return new cmGlobalUnixMakefileGenerator3; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalUnixMakefileGenerator3>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 47ce790..58bad59 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -25,8 +25,9 @@ class cmGlobalVisualStudio10Generator :
{
public:
cmGlobalVisualStudio10Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio10Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio10Generator>(); }
virtual std::string
GenerateBuildCommand(const char* makeProgram,
diff --git a/Source/cmGlobalVisualStudio10IA64Generator.h b/Source/cmGlobalVisualStudio10IA64Generator.h
index a088272..a7819a3 100644
--- a/Source/cmGlobalVisualStudio10IA64Generator.h
+++ b/Source/cmGlobalVisualStudio10IA64Generator.h
@@ -19,8 +19,9 @@ class cmGlobalVisualStudio10IA64Generator :
{
public:
cmGlobalVisualStudio10IA64Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio10IA64Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio10IA64Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h
index 8a2de4c..2728d15 100644
--- a/Source/cmGlobalVisualStudio10Win64Generator.h
+++ b/Source/cmGlobalVisualStudio10Win64Generator.h
@@ -19,8 +19,9 @@ class cmGlobalVisualStudio10Win64Generator :
{
public:
cmGlobalVisualStudio10Win64Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio10Win64Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio10Win64Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.h b/Source/cmGlobalVisualStudio11ARMGenerator.h
index 71dbf2e..b1d3037 100644
--- a/Source/cmGlobalVisualStudio11ARMGenerator.h
+++ b/Source/cmGlobalVisualStudio11ARMGenerator.h
@@ -19,8 +19,9 @@ class cmGlobalVisualStudio11ARMGenerator :
{
public:
cmGlobalVisualStudio11ARMGenerator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio11ARMGenerator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio11ARMGenerator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index 56337a4..c8f27a4 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -21,8 +21,9 @@ class cmGlobalVisualStudio11Generator:
{
public:
cmGlobalVisualStudio11Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio11Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio11Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio11Win64Generator.h b/Source/cmGlobalVisualStudio11Win64Generator.h
index 9445d15..5ddf4a7 100644
--- a/Source/cmGlobalVisualStudio11Win64Generator.h
+++ b/Source/cmGlobalVisualStudio11Win64Generator.h
@@ -19,8 +19,9 @@ class cmGlobalVisualStudio11Win64Generator :
{
public:
cmGlobalVisualStudio11Win64Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio11Win64Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio11Win64Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 259aa8d..bc23cf8 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -13,6 +13,7 @@
#define cmGlobalVisualStudio6Generator_h
#include "cmGlobalVisualStudioGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
class cmTarget;
@@ -25,8 +26,9 @@ class cmGlobalVisualStudio6Generator : public cmGlobalVisualStudioGenerator
{
public:
cmGlobalVisualStudio6Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio6Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio6Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index a8daad6..fa0ad92 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -24,8 +24,9 @@ class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator
{
public:
cmGlobalVisualStudio71Generator();
- static cmGlobalGenerator* New()
- { return new cmGlobalVisualStudio71Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio71Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 1df58f9..0f935c7 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -13,6 +13,7 @@
#define cmGlobalVisualStudio7Generator_h
#include "cmGlobalVisualStudioGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
class cmTarget;
struct cmIDEFlagTable;
@@ -26,8 +27,9 @@ class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
{
public:
cmGlobalVisualStudio7Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio7Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio7Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 5009f29..157464b 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -24,8 +24,9 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator
{
public:
cmGlobalVisualStudio8Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio8Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio8Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio8Win64Generator.h b/Source/cmGlobalVisualStudio8Win64Generator.h
index 12f8012..612c5d7 100644
--- a/Source/cmGlobalVisualStudio8Win64Generator.h
+++ b/Source/cmGlobalVisualStudio8Win64Generator.h
@@ -25,8 +25,9 @@ class cmGlobalVisualStudio8Win64Generator :
{
public:
cmGlobalVisualStudio8Win64Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio8Win64Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio8Win64Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h
index 0b0d143..d8d5e90 100644
--- a/Source/cmGlobalVisualStudio9Generator.h
+++ b/Source/cmGlobalVisualStudio9Generator.h
@@ -25,8 +25,9 @@ class cmGlobalVisualStudio9Generator :
{
public:
cmGlobalVisualStudio9Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio9Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio9Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio9IA64Generator.h b/Source/cmGlobalVisualStudio9IA64Generator.h
index 989b0d1..27bf71d 100644
--- a/Source/cmGlobalVisualStudio9IA64Generator.h
+++ b/Source/cmGlobalVisualStudio9IA64Generator.h
@@ -25,8 +25,9 @@ class cmGlobalVisualStudio9IA64Generator :
{
public:
cmGlobalVisualStudio9IA64Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio9IA64Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio9IA64Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalVisualStudio9Win64Generator.h b/Source/cmGlobalVisualStudio9Win64Generator.h
index 7c20cf4..e0c59ba 100644
--- a/Source/cmGlobalVisualStudio9Win64Generator.h
+++ b/Source/cmGlobalVisualStudio9Win64Generator.h
@@ -25,8 +25,9 @@ class cmGlobalVisualStudio9Win64Generator :
{
public:
cmGlobalVisualStudio9Win64Generator();
- static cmGlobalGenerator* New() {
- return new cmGlobalVisualStudio9Win64Generator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalVisualStudio9Win64Generator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h
index ee16eae..ac29b1c 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.h
+++ b/Source/cmGlobalWatcomWMakeGenerator.h
@@ -23,7 +23,9 @@ class cmGlobalWatcomWMakeGenerator : public cmGlobalUnixMakefileGenerator3
{
public:
cmGlobalWatcomWMakeGenerator();
- static cmGlobalGenerator* New() { return new cmGlobalWatcomWMakeGenerator; }
+ static cmGlobalGeneratorFactory* NewFactory() {
+ return new cmGlobalGeneratorSimpleFactory
+ <cmGlobalWatcomWMakeGenerator>(); }
///! Get the name for the generator.
virtual const char* GetName() const {
return cmGlobalWatcomWMakeGenerator::GetActualName();}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5b2ddd8..4b07a36 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -20,6 +20,7 @@
#include "cmSourceFile.h"
#include "cmCustomCommandGenerator.h"
#include "cmGeneratorTarget.h"
+#include "cmGlobalGeneratorFactory.h"
#include <cmsys/auto_ptr.hxx>
@@ -112,6 +113,15 @@ public:
}
};
+class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
+{
+public:
+ virtual cmGlobalGenerator* CreateGlobalGenerator() const;
+
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const {
+ cmGlobalXCodeGenerator().GetDocumentation(entry); }
+};
+
//----------------------------------------------------------------------------
cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version)
{
@@ -132,7 +142,14 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version)
}
//----------------------------------------------------------------------------
-cmGlobalGenerator* cmGlobalXCodeGenerator::New()
+cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory()
+{
+ return new Factory;
+}
+
+//----------------------------------------------------------------------------
+cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
+::CreateGlobalGenerator() const
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
cmXcodeVersionParser parser;
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index afa1ca2..c79293a 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -15,6 +15,7 @@
#include "cmGlobalGenerator.h"
#include "cmXCodeObject.h"
#include "cmCustomCommand.h"
+class cmGlobalGeneratorFactory;
class cmTarget;
class cmSourceFile;
class cmSourceGroup;
@@ -29,7 +30,7 @@ class cmGlobalXCodeGenerator : public cmGlobalGenerator
{
public:
cmGlobalXCodeGenerator(std::string const& version);
- static cmGlobalGenerator* New();
+ static cmGlobalGeneratorFactory* NewFactory();
///! Get the name for the generator.
virtual const char* GetName() const {
@@ -186,6 +187,7 @@ private:
const char* varNameSuffix,
const char* default_flags);
+ class Factory;
class BuildObjectListOrString;
friend class BuildObjectListOrString;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 0123427..08a322f 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -222,6 +222,11 @@ cmake::~cmake()
{
delete (*j).second;
}
+ for(RegisteredGeneratorsMap::iterator j = this->Generators.begin();
+ j != this->Generators.end(); ++j)
+ {
+ delete (*j).second;
+ }
#ifdef CMAKE_BUILD_WITH_CMAKE
delete this->VariableWatch;
#endif
@@ -1904,7 +1909,7 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name)
}
}
- generator = (genIt->second)();
+ generator = genIt->second->CreateGlobalGenerator();
generator->SetCMakeInstance(this);
generator->SetExternalMakefileProjectGenerator(extraGenerator);
return generator;
@@ -2571,54 +2576,54 @@ void cmake::AddDefaultGenerators()
#if defined(_WIN32) && !defined(__CYGWIN__)
# if !defined(CMAKE_BOOT_MINGW)
this->Generators[cmGlobalVisualStudio6Generator::GetActualName()] =
- &cmGlobalVisualStudio6Generator::New;
+ cmGlobalVisualStudio6Generator::NewFactory();
this->Generators[cmGlobalVisualStudio7Generator::GetActualName()] =
- &cmGlobalVisualStudio7Generator::New;
+ cmGlobalVisualStudio7Generator::NewFactory();
this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] =
- &cmGlobalVisualStudio10Generator::New;
+ cmGlobalVisualStudio10Generator::NewFactory();
this->Generators[cmGlobalVisualStudio10IA64Generator::GetActualName()] =
- &cmGlobalVisualStudio10IA64Generator::New;
+ cmGlobalVisualStudio10IA64Generator::NewFactory();
this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] =
- &cmGlobalVisualStudio10Win64Generator::New;
+ cmGlobalVisualStudio10Win64Generator::NewFactory();
this->Generators[cmGlobalVisualStudio11Generator::GetActualName()] =
- &cmGlobalVisualStudio11Generator::New;
+ cmGlobalVisualStudio11Generator::NewFactory();
this->Generators[cmGlobalVisualStudio11Win64Generator::GetActualName()] =
- &cmGlobalVisualStudio11Win64Generator::New;
+ cmGlobalVisualStudio11Win64Generator::NewFactory();
this->Generators[cmGlobalVisualStudio11ARMGenerator::GetActualName()] =
- &cmGlobalVisualStudio11ARMGenerator::New;
+ cmGlobalVisualStudio11ARMGenerator::NewFactory();
this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] =
- &cmGlobalVisualStudio71Generator::New;
+ cmGlobalVisualStudio71Generator::NewFactory();
this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] =
- &cmGlobalVisualStudio8Generator::New;
+ cmGlobalVisualStudio8Generator::NewFactory();
this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] =
- &cmGlobalVisualStudio9Generator::New;
+ cmGlobalVisualStudio9Generator::NewFactory();
this->Generators[cmGlobalVisualStudio9IA64Generator::GetActualName()] =
- &cmGlobalVisualStudio9IA64Generator::New;
+ cmGlobalVisualStudio9IA64Generator::NewFactory();
this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] =
- &cmGlobalVisualStudio9Win64Generator::New;
+ cmGlobalVisualStudio9Win64Generator::NewFactory();
this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] =
- &cmGlobalVisualStudio8Win64Generator::New;
+ cmGlobalVisualStudio8Win64Generator::NewFactory();
this->Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] =
- &cmGlobalBorlandMakefileGenerator::New;
+ cmGlobalBorlandMakefileGenerator::NewFactory();
this->Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] =
- &cmGlobalNMakeMakefileGenerator::New;
+ cmGlobalNMakeMakefileGenerator::NewFactory();
this->Generators[cmGlobalJOMMakefileGenerator::GetActualName()] =
- &cmGlobalJOMMakefileGenerator::New;
+ cmGlobalJOMMakefileGenerator::NewFactory();
this->Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] =
- &cmGlobalWatcomWMakeGenerator::New;
+ cmGlobalWatcomWMakeGenerator::NewFactory();
# endif
this->Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] =
- &cmGlobalMSYSMakefileGenerator::New;
+ cmGlobalMSYSMakefileGenerator::NewFactory();
this->Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] =
- &cmGlobalMinGWMakefileGenerator::New;
+ cmGlobalMinGWMakefileGenerator::NewFactory();
#endif
this->Generators[cmGlobalUnixMakefileGenerator3::GetActualName()] =
- &cmGlobalUnixMakefileGenerator3::New;
+ cmGlobalUnixMakefileGenerator3::NewFactory();
this->Generators[cmGlobalNinjaGenerator::GetActualName()] =
- &cmGlobalNinjaGenerator::New;
+ cmGlobalNinjaGenerator::NewFactory();
#ifdef CMAKE_USE_XCODE
this->Generators[cmGlobalXCodeGenerator::GetActualName()] =
- &cmGlobalXCodeGenerator::New;
+ cmGlobalXCodeGenerator::NewFactory();
#endif
}
@@ -2716,9 +2721,7 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
i != this->Generators.end(); ++i)
{
cmDocumentationEntry e;
- cmGlobalGenerator* generator = (i->second)();
- generator->GetDocumentation(e);
- delete generator;
+ i->second->GetDocumentation(e);
v.push_back(e);
}
for(RegisteredExtraGeneratorsMap::const_iterator
diff --git a/Source/cmake.h b/Source/cmake.h
index 94c6f12..e6bfa44 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -17,6 +17,7 @@
#include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h"
+class cmGlobalGeneratorFactory;
class cmGlobalGenerator;
class cmLocalGenerator;
class cmCacheManager;
@@ -396,10 +397,8 @@ protected:
cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
typedef std::map<cmStdString,
CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap;
-
- typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)();
typedef std::map<cmStdString,
- CreateGeneratorFunctionType> RegisteredGeneratorsMap;
+ cmGlobalGeneratorFactory*> RegisteredGeneratorsMap;
RegisteredCommandsMap Commands;
RegisteredGeneratorsMap Generators;
RegisteredExtraGeneratorsMap ExtraGenerators;