[Cmake-commits] CMake branch, next, updated. v2.8.10.1-919-gf23f91c

Brad King brad.king at kitware.com
Mon Nov 19 12:56:42 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  f23f91cbfc124ccf177b0dc7470818b3a0a9d5a3 (commit)
       via  04ff866ca8a0c5f4f8712d6cfafcd192ed4cbe58 (commit)
       via  984ebc3350f72cb005999f7b796803f83be15304 (commit)
       via  30a695021ccc6583493b3e7f9992ad428cd2855f (commit)
       via  e8f841473bcefc618ddf6712567e624156e88399 (commit)
      from  3332147c5ac9fa7157776d80fdccc6acd14da576 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f23f91cbfc124ccf177b0dc7470818b3a0a9d5a3
commit f23f91cbfc124ccf177b0dc7470818b3a0a9d5a3
Merge: 3332147 04ff866
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Nov 19 12:56:40 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Nov 19 12:56:40 2012 -0500

    Merge topic 'generator-factory' into next
    
    04ff866 Allow a GeneratorFactory handling of more than one generator
    984ebc3 Search generator in cmake::ExtraGenerators before in cmake::Generators
    30a6950 Add cmGlobalGeneratorFactory::GetGenerators()
    e8f8414 Introduce the abstract class cmGlobalGeneratorFactory


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=04ff866ca8a0c5f4f8712d6cfafcd192ed4cbe58
commit 04ff866ca8a0c5f4f8712d6cfafcd192ed4cbe58
Author:     Patrick Gansterer <paroga at paroga.com>
AuthorDate: Mon Nov 19 16:13:54 2012 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Nov 19 12:54:35 2012 -0500

    Allow a GeneratorFactory handling of more than one generator
    
    Pass the name of the requested generator to the generator factory,
    which is now responsible to check if it can create a matching
    generator for the name. This allows us to add more logic to the
    factory in a next step, so that not every possible generator needs
    to get registered explicit in cmake::AddDefaultGenerators().

diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
index 9d8f7a0..0dfb362 100644
--- a/Source/cmGlobalGeneratorFactory.h
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -29,7 +29,7 @@ public:
   virtual ~cmGlobalGeneratorFactory() {}
 
   /** Create a GlobalGenerator */
-  virtual cmGlobalGenerator* CreateGlobalGenerator() const = 0;
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* n) const = 0;
 
   /** Get the documentation entry for this factory */
   virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
@@ -43,7 +43,8 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
 {
 public:
   /** Create a GlobalGenerator */
-  virtual cmGlobalGenerator* CreateGlobalGenerator() const {
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
+    if (strcmp(name, T::GetActualName())) return 0;
     return new T; }
 
   /** Get the documentation entry for this factory */
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 59ca652..e6f3422 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -116,7 +116,7 @@ public:
 class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator() const;
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const;
 
   virtual void GetDocumentation(cmDocumentationEntry& entry) const {
     cmGlobalXCodeGenerator().GetDocumentation(entry); }
@@ -152,8 +152,10 @@ cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory()
 
 //----------------------------------------------------------------------------
 cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
-::CreateGlobalGenerator() const
+::CreateGlobalGenerator(const char* name) const
 {
+  if (strcmp(name, GetActualName()))
+    return 0;
 #if defined(CMAKE_BUILD_WITH_CMAKE)
   cmXcodeVersionParser parser;
   std::string versionFile;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index cd71507..3eda86d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -222,10 +222,10 @@ cmake::~cmake()
     {
     delete (*j).second;
     }
-  for(RegisteredGeneratorsMap::iterator j = this->Generators.begin();
+  for(RegisteredGeneratorsVector::iterator j = this->Generators.begin();
       j != this->Generators.end(); ++j)
     {
-    delete (*j).second;
+    delete *j;
     }
 #ifdef CMAKE_BUILD_WITH_CMAKE
   delete this->VariableWatch;
@@ -1874,10 +1874,10 @@ void cmake::AddDefaultExtraGenerators()
 //----------------------------------------------------------------------------
 void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
 {
-  for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin();
+  for(RegisteredGeneratorsVector::const_iterator i = this->Generators.begin();
       i != this->Generators.end(); ++i)
     {
-    i->second->GetGenerators(names);
+    (*i)->GetGenerators(names);
     }
   for(RegisteredExtraGeneratorsMap::const_iterator
       i = this->ExtraGenerators.begin();
@@ -1899,10 +1899,14 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name)
     }
 
   cmGlobalGenerator* generator = 0;
-  RegisteredGeneratorsMap::const_iterator genIt = this->Generators.find(name);
-  if(genIt != this->Generators.end())
+  for (RegisteredGeneratorsVector::const_iterator i =
+    this->Generators.begin(); i != this->Generators.end(); ++i)
     {
-    generator = genIt->second->CreateGlobalGenerator();
+    generator = (*i)->CreateGlobalGenerator(name);
+    if (generator)
+      {
+      break;
+      }
     }
 
   if (generator)
@@ -2578,55 +2582,55 @@ void cmake::AddDefaultGenerators()
 {
 #if defined(_WIN32) && !defined(__CYGWIN__)
 # if !defined(CMAKE_BOOT_MINGW)
-  this->Generators[cmGlobalVisualStudio6Generator::GetActualName()] =
-    cmGlobalVisualStudio6Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio7Generator::GetActualName()] =
-    cmGlobalVisualStudio7Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] =
-    cmGlobalVisualStudio10Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio10IA64Generator::GetActualName()] =
-    cmGlobalVisualStudio10IA64Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] =
-    cmGlobalVisualStudio10Win64Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio11Generator::GetActualName()] =
-    cmGlobalVisualStudio11Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio11Win64Generator::GetActualName()] =
-    cmGlobalVisualStudio11Win64Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio11ARMGenerator::GetActualName()] =
-    cmGlobalVisualStudio11ARMGenerator::NewFactory();
-  this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] =
-    cmGlobalVisualStudio71Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] =
-    cmGlobalVisualStudio8Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] =
-    cmGlobalVisualStudio9Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio9IA64Generator::GetActualName()] =
-    cmGlobalVisualStudio9IA64Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] =
-    cmGlobalVisualStudio9Win64Generator::NewFactory();
-  this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] =
-    cmGlobalVisualStudio8Win64Generator::NewFactory();
-  this->Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] =
-    cmGlobalBorlandMakefileGenerator::NewFactory();
-  this->Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] =
-    cmGlobalNMakeMakefileGenerator::NewFactory();
-  this->Generators[cmGlobalJOMMakefileGenerator::GetActualName()] =
-    cmGlobalJOMMakefileGenerator::NewFactory();
-  this->Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] =
-    cmGlobalWatcomWMakeGenerator::NewFactory();
+  this->Generators.push_back(
+    cmGlobalVisualStudio6Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio7Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio10Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio10IA64Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio10Win64Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio11Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio11Win64Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio11ARMGenerator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio71Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio8Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio9Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio9IA64Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio9Win64Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio8Win64Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalBorlandMakefileGenerator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalNMakeMakefileGenerator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalJOMMakefileGenerator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalWatcomWMakeGenerator::NewFactory());
 # endif
-  this->Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] =
-    cmGlobalMSYSMakefileGenerator::NewFactory();
-  this->Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] =
-    cmGlobalMinGWMakefileGenerator::NewFactory();
+  this->Generators.push_back(
+    cmGlobalMSYSMakefileGenerator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalMinGWMakefileGenerator::NewFactory());
 #endif
-  this->Generators[cmGlobalUnixMakefileGenerator3::GetActualName()] =
-    cmGlobalUnixMakefileGenerator3::NewFactory();
-  this->Generators[cmGlobalNinjaGenerator::GetActualName()] =
-    cmGlobalNinjaGenerator::NewFactory();
+  this->Generators.push_back(
+    cmGlobalUnixMakefileGenerator3::NewFactory());
+  this->Generators.push_back(
+    cmGlobalNinjaGenerator::NewFactory());
 #ifdef CMAKE_USE_XCODE
-  this->Generators[cmGlobalXCodeGenerator::GetActualName()] =
-    cmGlobalXCodeGenerator::NewFactory();
+  this->Generators.push_back(
+    cmGlobalXCodeGenerator::NewFactory());
 #endif
 }
 
@@ -2720,15 +2724,15 @@ void cmake::GetPropertiesDocumentation(std::map<std::string,
 
 void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
 {
-  for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin();
-      i != this->Generators.end(); ++i)
+  for(RegisteredGeneratorsVector::const_iterator i =
+      this->Generators.begin(); i != this->Generators.end(); ++i)
     {
     cmDocumentationEntry e;
-    i->second->GetDocumentation(e);
+    (*i)->GetDocumentation(e);
     v.push_back(e);
     }
-  for(RegisteredExtraGeneratorsMap::const_iterator
-      i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i)
+  for(RegisteredExtraGeneratorsMap::const_iterator i =
+      this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i)
     {
     cmDocumentationEntry e;
     cmExternalMakefileProjectGenerator* generator = (i->second)();
diff --git a/Source/cmake.h b/Source/cmake.h
index e6bfa44..79e05ca 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -397,10 +397,9 @@ protected:
      cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
   typedef std::map<cmStdString,
                 CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap;
-  typedef std::map<cmStdString,
-                   cmGlobalGeneratorFactory*> RegisteredGeneratorsMap;
+  typedef std::vector<cmGlobalGeneratorFactory*> RegisteredGeneratorsVector;
   RegisteredCommandsMap Commands;
-  RegisteredGeneratorsMap Generators;
+  RegisteredGeneratorsVector Generators;
   RegisteredExtraGeneratorsMap ExtraGenerators;
   void AddDefaultCommands();
   void AddDefaultGenerators();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=984ebc3350f72cb005999f7b796803f83be15304
commit 984ebc3350f72cb005999f7b796803f83be15304
Author:     Patrick Gansterer <paroga at paroga.com>
AuthorDate: Mon Nov 19 15:56:31 2012 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Nov 19 12:54:34 2012 -0500

    Search generator in cmake::ExtraGenerators before in cmake::Generators
    
    Since ExtraGenerators does not contain items, which are in Generators
    too, there is not change in behaviour. The benefit of this change is,
    that the lookup in the Generators map is now only done once.

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 2d531ba..cd71507 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1889,29 +1889,32 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
 
 cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name)
 {
-  cmGlobalGenerator* generator = 0;
   cmExternalMakefileProjectGenerator* extraGenerator = 0;
-  RegisteredGeneratorsMap::const_iterator genIt = this->Generators.find(name);
-  if(genIt == this->Generators.end())
+  RegisteredExtraGeneratorsMap::const_iterator extraGenIt =
+                                            this->ExtraGenerators.find(name);
+  if (extraGenIt != this->ExtraGenerators.end())
     {
-    RegisteredExtraGeneratorsMap::const_iterator extraGenIt =
-                                              this->ExtraGenerators.find(name);
-    if (extraGenIt == this->ExtraGenerators.end())
-      {
-      return 0;
-      }
     extraGenerator = (extraGenIt->second)();
-    genIt=this->Generators.find(extraGenerator->GetGlobalGeneratorName(name));
-    if(genIt == this->Generators.end())
-      {
-      delete extraGenerator;
-      return 0;
-      }
-  }
+    name = extraGenerator->GetGlobalGeneratorName(name);
+    }
+
+  cmGlobalGenerator* generator = 0;
+  RegisteredGeneratorsMap::const_iterator genIt = this->Generators.find(name);
+  if(genIt != this->Generators.end())
+    {
+    generator = genIt->second->CreateGlobalGenerator();
+    }
+
+  if (generator)
+    {
+    generator->SetCMakeInstance(this);
+    generator->SetExternalMakefileProjectGenerator(extraGenerator);
+    }
+  else
+    {
+    delete extraGenerator;
+    }
 
-  generator = genIt->second->CreateGlobalGenerator();
-  generator->SetCMakeInstance(this);
-  generator->SetExternalMakefileProjectGenerator(extraGenerator);
   return generator;
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30a695021ccc6583493b3e7f9992ad428cd2855f
commit 30a695021ccc6583493b3e7f9992ad428cd2855f
Author:     Patrick Gansterer <paroga at paroga.com>
AuthorDate: Mon Nov 19 15:52:46 2012 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Nov 19 12:54:34 2012 -0500

    Add cmGlobalGeneratorFactory::GetGenerators()
    
    This allows cmGlobalGeneratorFactory to create more than
    one type of cmGlobalGenerator in a next step.

diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
index 05c8420..9d8f7a0 100644
--- a/Source/cmGlobalGeneratorFactory.h
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -33,6 +33,9 @@ public:
 
   /** Get the documentation entry for this factory */
   virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
+
+  /** Get the names of the current registered generators */
+  virtual void GetGenerators(std::vector<std::string>& names) const = 0;
 };
 
 template<class T>
@@ -46,6 +49,10 @@ public:
   /** Get the documentation entry for this factory */
   virtual void GetDocumentation(cmDocumentationEntry& entry) const {
     T().GetDocumentation(entry); }
+
+  /** Get the names of the current registered generators */
+  virtual void GetGenerators(std::vector<std::string>& names) const {
+    names.push_back(T::GetActualName()); }
 };
 
 #endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 4b07a36..59ca652 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -120,6 +120,9 @@ public:
 
   virtual void GetDocumentation(cmDocumentationEntry& entry) const {
     cmGlobalXCodeGenerator().GetDocumentation(entry); }
+
+  virtual void GetGenerators(std::vector<std::string>& names) const {
+    names.push_back(cmGlobalXCodeGenerator::GetActualName()); }
 };
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 08a322f..2d531ba 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1877,7 +1877,7 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
   for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin();
       i != this->Generators.end(); ++i)
     {
-    names.push_back(i->first);
+    i->second->GetGenerators(names);
     }
   for(RegisteredExtraGeneratorsMap::const_iterator
       i = this->ExtraGenerators.begin();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e8f841473bcefc618ddf6712567e624156e88399
commit e8f841473bcefc618ddf6712567e624156e88399
Author:     Patrick Gansterer <paroga at paroga.com>
AuthorDate: Mon Nov 19 15:48:33 2012 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Nov 19 12:54:30 2012 -0500

    Introduce the abstract class cmGlobalGeneratorFactory
    
    This new abstract class allows us move some logic from the
    cmGlobalGenerator into its own layer in a next step.

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;

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list