Răsfoiți Sursa

stringapi: Use strings for generator names

Ben Boeckel 11 ani în urmă
părinte
comite
1a1b737c99
52 a modificat fișierele cu 221 adăugiri și 190 ștergeri
  1. 1 2
      Source/CTest/cmCTestBuildCommand.cxx
  2. 3 2
      Source/cmComputeLinkInformation.cxx
  3. 11 11
      Source/cmExternalMakefileProjectGenerator.cxx
  4. 6 5
      Source/cmExternalMakefileProjectGenerator.h
  5. 5 4
      Source/cmExtraCodeBlocksGenerator.cxx
  6. 3 3
      Source/cmExtraCodeBlocksGenerator.h
  7. 1 1
      Source/cmExtraCodeLiteGenerator.cxx
  8. 3 3
      Source/cmExtraCodeLiteGenerator.h
  9. 1 1
      Source/cmExtraEclipseCDT4Generator.cxx
  10. 3 3
      Source/cmExtraEclipseCDT4Generator.h
  11. 2 2
      Source/cmExtraKateGenerator.cxx
  12. 3 3
      Source/cmExtraKateGenerator.h
  13. 6 5
      Source/cmExtraSublimeTextGenerator.cxx
  14. 3 3
      Source/cmExtraSublimeTextGenerator.h
  15. 2 2
      Source/cmGlobalBorlandMakefileGenerator.h
  16. 2 2
      Source/cmGlobalGenerator.cxx
  17. 4 4
      Source/cmGlobalGenerator.h
  18. 5 3
      Source/cmGlobalGeneratorFactory.h
  19. 2 2
      Source/cmGlobalJOMMakefileGenerator.h
  20. 1 1
      Source/cmGlobalKdevelopGenerator.cxx
  21. 3 3
      Source/cmGlobalKdevelopGenerator.h
  22. 2 2
      Source/cmGlobalMSYSMakefileGenerator.h
  23. 2 2
      Source/cmGlobalMinGWMakefileGenerator.h
  24. 2 2
      Source/cmGlobalNMakeMakefileGenerator.h
  25. 2 2
      Source/cmGlobalNinjaGenerator.h
  26. 2 2
      Source/cmGlobalUnixMakefileGenerator3.cxx
  27. 2 2
      Source/cmGlobalUnixMakefileGenerator3.h
  28. 13 11
      Source/cmGlobalVisualStudio10Generator.cxx
  29. 4 3
      Source/cmGlobalVisualStudio10Generator.h
  30. 13 11
      Source/cmGlobalVisualStudio11Generator.cxx
  31. 4 3
      Source/cmGlobalVisualStudio11Generator.h
  32. 13 11
      Source/cmGlobalVisualStudio12Generator.cxx
  33. 4 3
      Source/cmGlobalVisualStudio12Generator.h
  34. 2 2
      Source/cmGlobalVisualStudio6Generator.h
  35. 5 4
      Source/cmGlobalVisualStudio71Generator.cxx
  36. 4 4
      Source/cmGlobalVisualStudio71Generator.h
  37. 13 9
      Source/cmGlobalVisualStudio7Generator.cxx
  38. 5 5
      Source/cmGlobalVisualStudio7Generator.h
  39. 17 12
      Source/cmGlobalVisualStudio8Generator.cxx
  40. 5 4
      Source/cmGlobalVisualStudio8Generator.h
  41. 8 6
      Source/cmGlobalVisualStudio9Generator.cxx
  42. 3 2
      Source/cmGlobalVisualStudio9Generator.h
  43. 2 2
      Source/cmGlobalVisualStudioGenerator.cxx
  44. 1 1
      Source/cmGlobalVisualStudioGenerator.h
  45. 2 2
      Source/cmGlobalWatcomWMakeGenerator.h
  46. 4 3
      Source/cmGlobalXCodeGenerator.cxx
  47. 2 2
      Source/cmGlobalXCodeGenerator.h
  48. 1 1
      Source/cmLocalVisualStudio7Generator.h
  49. 2 2
      Source/cmMakefile.cxx
  50. 1 1
      Source/cmQtAutoGenerators.cxx
  51. 9 7
      Source/cmake.cxx
  52. 2 2
      Source/cmake.h

+ 1 - 2
Source/CTest/cmCTestBuildCommand.cxx

@@ -101,8 +101,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
         }
       if ( this->GlobalGenerator )
         {
-        if ( strcmp(this->GlobalGenerator->GetName(),
-            cmakeGeneratorName) != 0 )
+        if ( this->GlobalGenerator->GetName() != cmakeGeneratorName )
           {
           delete this->GlobalGenerator;
           this->GlobalGenerator = 0;

+ 3 - 2
Source/cmComputeLinkInformation.cxx

@@ -1127,9 +1127,10 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
 
   // Full path libraries should specify a valid library file name.
   // See documentation of CMP0008.
+  std::string generator = this->GlobalGenerator->GetName();
   if(this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
-     (strstr(this->GlobalGenerator->GetName(), "Visual Studio") ||
-      strstr(this->GlobalGenerator->GetName(), "Xcode")))
+     (generator.find("Visual Studio") != generator.npos ||
+      generator.find("Xcode") != generator.npos))
     {
     std::string file = cmSystemTools::GetFilenameName(item);
     if(!this->ExtractAnyLibraryName.find(file.c_str()))

+ 11 - 11
Source/cmExternalMakefileProjectGenerator.cxx

@@ -20,13 +20,13 @@ void cmExternalMakefileProjectGenerator
 }
 
 std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
-                                                   const char* globalGenerator,
-                                                   const char* extraGenerator)
+                                            const std::string& globalGenerator,
+                                            const std::string& extraGenerator)
 {
   std::string fullName;
-  if (globalGenerator)
+  if (!globalGenerator.empty())
     {
-    if (extraGenerator && *extraGenerator)
+    if (!extraGenerator.empty())
       {
       fullName = extraGenerator;
       fullName += " - ";
@@ -36,22 +36,22 @@ std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
   return fullName;
 }
 
-const char* cmExternalMakefileProjectGenerator::GetGlobalGeneratorName(
-                                                          const char* fullName)
+std::string cmExternalMakefileProjectGenerator::GetGlobalGeneratorName(
+                                                  const std::string& fullName)
 {
   // at least one global generator must be supported
   assert(!this->SupportedGlobalGenerators.empty());
 
-  if (fullName==0)
+  if (fullName.empty())
     {
-    return 0;
+    return "";
     }
 
   std::string currentName = fullName;
   // if we get only the short name, take the first global generator as default
   if (currentName == this->GetName())
     {
-    return this->SupportedGlobalGenerators[0].c_str();
+    return this->SupportedGlobalGenerators[0];
     }
 
   // otherwise search for the matching global generator
@@ -63,8 +63,8 @@ const char* cmExternalMakefileProjectGenerator::GetGlobalGeneratorName(
       if (this->CreateFullGeneratorName(it->c_str(), this->GetName())
                                                                 == currentName)
       {
-        return it->c_str();
+        return *it;
       }
     }
-  return 0;
+  return "";
 }

+ 6 - 5
Source/cmExternalMakefileProjectGenerator.h

@@ -37,10 +37,10 @@ public:
   virtual ~cmExternalMakefileProjectGenerator() {}
 
   ///! Get the name for this generator.
-  virtual const char* GetName() const = 0;
+  virtual std::string GetName() const = 0;
   /** Get the documentation entry for this generator.  */
   virtual void GetDocumentation(cmDocumentationEntry& entry,
-                                const char* fullName) const = 0;
+                                const std::string& fullName) const = 0;
   virtual void EnableLanguage(std::vector<std::string> const& languages,
                               cmMakefile *, bool optional);
 
@@ -53,12 +53,13 @@ public:
                                       {return this->SupportedGlobalGenerators;}
 
   ///! Get the name of the global generator for the given full name
-  const char* GetGlobalGeneratorName(const char* fullName);
+  std::string GetGlobalGeneratorName(const std::string& fullName);
   /** Create a full name from the given global generator name and the
    * extra generator name
    */
-  static std::string CreateFullGeneratorName(const char* globalGenerator,
-                                             const char* extraGenerator);
+  static std::string CreateFullGeneratorName(
+                                            const std::string& globalGenerator,
+                                            const std::string& extraGenerator);
 
   ///! Generate the project files, the Makefiles have already been generated
   virtual void Generate() = 0;

+ 5 - 4
Source/cmExtraCodeBlocksGenerator.cxx

@@ -38,7 +38,7 @@ http://forums.codeblocks.org/index.php/topic,6789.0.html
 
 //----------------------------------------------------------------------------
 void cmExtraCodeBlocksGenerator
-::GetDocumentation(cmDocumentationEntry& entry, const char*) const
+::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
 {
   entry.Name = this->GetName();
   entry.Brief = "Generates CodeBlocks project files.";
@@ -761,7 +761,8 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
              const std::string& target)
 {
   std::string command = make;
-  if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0)
+  std::string generator = this->GlobalGenerator->GetName();
+  if (generator == "NMake Makefiles")
     {
     // For Windows ConvertToOutputPath already adds quotes when required.
     // These need to be escaped, see
@@ -772,7 +773,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
     command += " VERBOSE=1 ";
     command += target;
     }
-  else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0)
+  else if (generator == "MinGW Makefiles")
     {
     // no escaping of spaces in this case, see
     // http://public.kitware.com/Bug/view.php?id=10014
@@ -783,7 +784,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
     command += " VERBOSE=1 ";
     command += target;
     }
-  else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
+  else if (generator == "Ninja")
     {
     command += " -v ";
     command += target;

+ 3 - 3
Source/cmExtraCodeBlocksGenerator.h

@@ -28,14 +28,14 @@ class cmExtraCodeBlocksGenerator : public cmExternalMakefileProjectGenerator
 public:
   cmExtraCodeBlocksGenerator();
 
-  virtual const char* GetName() const
+  virtual std::string GetName() const
                          { return cmExtraCodeBlocksGenerator::GetActualName();}
-  static const char* GetActualName()                    { return "CodeBlocks";}
+  static std::string GetActualName()                    { return "CodeBlocks";}
   static cmExternalMakefileProjectGenerator* New()
                                      { return new cmExtraCodeBlocksGenerator; }
   /** Get the documentation entry for this generator.  */
   virtual void GetDocumentation(cmDocumentationEntry& entry,
-                                const char* fullName) const;
+                                const std::string& fullName) const;
 
   virtual void Generate();
 private:

+ 1 - 1
Source/cmExtraCodeLiteGenerator.cxx

@@ -28,7 +28,7 @@
 
 //----------------------------------------------------------------------------
 void cmExtraCodeLiteGenerator::GetDocumentation(cmDocumentationEntry& entry,
-                                                const char*) const
+                                                const std::string&) const
 {
   entry.Name = this->GetName();
   entry.Brief = "Generates CodeLite project files.";

+ 3 - 3
Source/cmExtraCodeLiteGenerator.h

@@ -35,14 +35,14 @@ protected:
 public:
   cmExtraCodeLiteGenerator();
 
-  virtual const char* GetName() const
+  virtual std::string GetName() const
                           { return cmExtraCodeLiteGenerator::GetActualName();}
-  static const char* GetActualName()                     { return "CodeLite";}
+  static std::string GetActualName()                     { return "CodeLite";}
   static cmExternalMakefileProjectGenerator* New()
                                       { return new cmExtraCodeLiteGenerator; }
   /** Get the documentation entry for this generator.  */
   virtual void GetDocumentation(cmDocumentationEntry& entry,
-                                const char* fullName) const;
+                                const std::string& fullName) const;
 
   virtual void Generate();
   void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);

+ 1 - 1
Source/cmExtraEclipseCDT4Generator.cxx

@@ -45,7 +45,7 @@ cmExtraEclipseCDT4Generator
 
 //----------------------------------------------------------------------------
 void cmExtraEclipseCDT4Generator
-::GetDocumentation(cmDocumentationEntry& entry, const char*) const
+::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
 {
   entry.Name = this->GetName();
   entry.Brief = "Generates Eclipse CDT 4.0 project files.";

+ 3 - 3
Source/cmExtraEclipseCDT4Generator.h

@@ -33,14 +33,14 @@ public:
     return new cmExtraEclipseCDT4Generator;
   }
 
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmExtraEclipseCDT4Generator::GetActualName();
   }
 
-  static const char* GetActualName() { return "Eclipse CDT4"; }
+  static std::string GetActualName() { return "Eclipse CDT4"; }
 
   virtual void GetDocumentation(cmDocumentationEntry& entry,
-                                const char*           fullName) const;
+                                const std::string&    fullName) const;
   virtual void EnableLanguage(std::vector<std::string> const& languages,
                               cmMakefile *, bool optional);
 

+ 2 - 2
Source/cmExtraKateGenerator.cxx

@@ -25,7 +25,7 @@
 
 //----------------------------------------------------------------------------
 void cmExtraKateGenerator
-::GetDocumentation(cmDocumentationEntry& entry, const char*) const
+::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
 {
   entry.Name = this->GetName();
   entry.Brief = "Generates Kate project files.";
@@ -52,7 +52,7 @@ void cmExtraKateGenerator::Generate()
   this->ProjectName = this->GenerateProjectName(mf->GetProjectName(),
                           mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
                           this->GetPathBasename(mf->GetHomeOutputDirectory()));
-  this->UseNinja = (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0);
+  this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja");
 
   this->CreateKateProjectFile(mf);
   this->CreateDummyKateProjectFile(mf);

+ 3 - 3
Source/cmExtraKateGenerator.h

@@ -28,14 +28,14 @@ class cmExtraKateGenerator : public cmExternalMakefileProjectGenerator
 public:
   cmExtraKateGenerator();
 
-  virtual const char* GetName() const
+  virtual std::string GetName() const
                          { return cmExtraKateGenerator::GetActualName();}
-  static const char* GetActualName()                    { return "Kate";}
+  static std::string GetActualName()                    { return "Kate";}
   static cmExternalMakefileProjectGenerator* New()
                                      { return new cmExtraKateGenerator; }
   /** Get the documentation entry for this generator.  */
   virtual void GetDocumentation(cmDocumentationEntry& entry,
-                                const char* fullName) const;
+                                const std::string& fullName) const;
 
   virtual void Generate();
 private:

+ 6 - 5
Source/cmExtraSublimeTextGenerator.cxx

@@ -41,7 +41,7 @@ http://sublimetext.info/docs/en/reference/build_systems.html
 
 //----------------------------------------------------------------------------
 void cmExtraSublimeTextGenerator
-::GetDocumentation(cmDocumentationEntry& entry, const char*) const
+::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
 {
   entry.Name = this->GetName();
   entry.Brief = "Generates Sublime Text 2 project files.";
@@ -290,7 +290,7 @@ void cmExtraSublimeTextGenerator::
   // Ninja uses ninja.build files (look for a way to get the output file name
   // from cmMakefile or something)
   std::string makefileName;
-  if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
+  if (this->GlobalGenerator->GetName() == "Ninja")
     {
       makefileName = "build.ninja";
     }
@@ -320,7 +320,8 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
 {
   std::string command = "\"";
   command += make + "\"";
-  if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0)
+  std::string generator = this->GlobalGenerator->GetName();
+  if (generator == "NMake Makefiles")
     {
     std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
     command += ", \"/NOLOGO\", \"/f\", \"";
@@ -329,7 +330,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
     command += target;
     command += "\"";
     }
-  else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
+  else if (generator == "Ninja")
     {
     std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
     command += ", \"-f\", \"";
@@ -341,7 +342,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
   else
     {
     std::string makefileName;
-    if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0)
+    if (generator == "MinGW Makefiles")
       {
         // no escaping of spaces in this case, see
         // http://public.kitware.com/Bug/view.php?id=10014

+ 3 - 3
Source/cmExtraSublimeTextGenerator.h

@@ -31,15 +31,15 @@ public:
   typedef std::map<std::string, std::vector<std::string> > MapSourceFileFlags;
   cmExtraSublimeTextGenerator();
 
-  virtual const char* GetName() const
+  virtual std::string GetName() const
                         { return cmExtraSublimeTextGenerator::GetActualName();}
-  static const char* GetActualName()
+  static std::string GetActualName()
                         { return "Sublime Text 2";}
   static cmExternalMakefileProjectGenerator* New()
                                     { return new cmExtraSublimeTextGenerator; }
   /** Get the documentation entry for this generator.  */
   virtual void GetDocumentation(cmDocumentationEntry& entry,
-                                const char* fullName) const;
+                                const std::string& fullName) const;
 
   virtual void Generate();
 private:

+ 2 - 2
Source/cmGlobalBorlandMakefileGenerator.h

@@ -28,9 +28,9 @@ public:
       <cmGlobalBorlandMakefileGenerator>(); }
 
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalBorlandMakefileGenerator::GetActualName();}
-  static const char* GetActualName() {return "Borland Makefiles";}
+  static std::string GetActualName() {return "Borland Makefiles";}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);

+ 2 - 2
Source/cmGlobalGenerator.cxx

@@ -2599,9 +2599,9 @@ void cmGlobalGenerator::SetExternalMakefileProjectGenerator(
     }
 }
 
-const char* cmGlobalGenerator::GetExtraGeneratorName() const
+std::string cmGlobalGenerator::GetExtraGeneratorName() const
 {
-  return this->ExtraGenerator==0 ? 0 : this->ExtraGenerator->GetName();
+  return this->ExtraGenerator? this->ExtraGenerator->GetName() : std::string();
 }
 
 void cmGlobalGenerator::FileReplacedDuringGenerate(const std::string& filename)

+ 4 - 4
Source/cmGlobalGenerator.h

@@ -51,11 +51,11 @@ public:
   virtual cmLocalGenerator *CreateLocalGenerator();
 
   ///! Get the name for this generator
-  virtual const char *GetName() const { return "Generic"; };
+  virtual std::string GetName() const { return "Generic"; };
 
   /** Check whether the given name matches the current generator.  */
-  virtual bool MatchesGeneratorName(const char* name) const
-  { return strcmp(this->GetName(), name) == 0; }
+  virtual bool MatchesGeneratorName(const std::string& name) const
+  { return this->GetName() == name; }
 
   /** Set the generator-specific toolset name.  Returns true if toolset
       is supported and false otherwise.  */
@@ -163,7 +163,7 @@ public:
   void SetExternalMakefileProjectGenerator(
                            cmExternalMakefileProjectGenerator *extraGenerator);
 
-  const char* GetExtraGeneratorName() const;
+  std::string GetExtraGeneratorName() const;
 
   void AddInstallComponent(const char* component);
 

+ 5 - 3
Source/cmGlobalGeneratorFactory.h

@@ -29,7 +29,8 @@ public:
   virtual ~cmGlobalGeneratorFactory() {}
 
   /** Create a GlobalGenerator */
-  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* n) const = 0;
+  virtual cmGlobalGenerator* CreateGlobalGenerator(
+      const std::string& n) const = 0;
 
   /** Get the documentation entry for this factory */
   virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
@@ -43,8 +44,9 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
 {
 public:
   /** Create a GlobalGenerator */
-  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
-    if (strcmp(name, T::GetActualName())) return 0;
+  virtual cmGlobalGenerator* CreateGlobalGenerator(
+                                              const std::string& name) const {
+    if (name != T::GetActualName()) return 0;
     return new T; }
 
   /** Get the documentation entry for this factory */

+ 2 - 2
Source/cmGlobalJOMMakefileGenerator.h

@@ -27,11 +27,11 @@ public:
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalJOMMakefileGenerator>(); }
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalJOMMakefileGenerator::GetActualName();}
   // use NMake Makefiles in the name so that scripts/tests that depend on the
   // name NMake Makefiles will work
-  static const char* GetActualName() {return "NMake Makefiles JOM";}
+  static std::string GetActualName() {return "NMake Makefiles JOM";}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);

+ 1 - 1
Source/cmGlobalKdevelopGenerator.cxx

@@ -25,7 +25,7 @@
 
 //----------------------------------------------------------------------------
 void cmGlobalKdevelopGenerator
-::GetDocumentation(cmDocumentationEntry& entry, const char*) const
+::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
 {
   entry.Name = this->GetName();
   entry.Brief = "Generates KDevelop 3 project files.";

+ 3 - 3
Source/cmGlobalKdevelopGenerator.h

@@ -33,14 +33,14 @@ class cmGlobalKdevelopGenerator : public cmExternalMakefileProjectGenerator
 public:
   cmGlobalKdevelopGenerator();
 
-  virtual const char* GetName() const
+  virtual std::string GetName() const
                           { return cmGlobalKdevelopGenerator::GetActualName();}
-  static const char* GetActualName()                     { return "KDevelop3";}
+  static std::string GetActualName()                     { return "KDevelop3";}
   static cmExternalMakefileProjectGenerator* New()
                                       { return new cmGlobalKdevelopGenerator; }
   /** Get the documentation entry for this generator.  */
   virtual void GetDocumentation(cmDocumentationEntry& entry,
-                                const char* fullName) const;
+                                const std::string& fullName) const;
 
   virtual void Generate();
 private:

+ 2 - 2
Source/cmGlobalMSYSMakefileGenerator.h

@@ -28,9 +28,9 @@ public:
       <cmGlobalMSYSMakefileGenerator>(); }
 
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalMSYSMakefileGenerator::GetActualName();}
-  static const char* GetActualName() {return "MSYS Makefiles";}
+  static std::string GetActualName() {return "MSYS Makefiles";}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);

+ 2 - 2
Source/cmGlobalMinGWMakefileGenerator.h

@@ -27,9 +27,9 @@ public:
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalMinGWMakefileGenerator>(); }
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalMinGWMakefileGenerator::GetActualName();}
-  static const char* GetActualName() {return "MinGW Makefiles";}
+  static std::string GetActualName() {return "MinGW Makefiles";}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);

+ 2 - 2
Source/cmGlobalNMakeMakefileGenerator.h

@@ -27,9 +27,9 @@ public:
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalNMakeMakefileGenerator>(); }
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalNMakeMakefileGenerator::GetActualName();}
-  static const char* GetActualName() {return "NMake Makefiles";}
+  static std::string GetActualName() {return "NMake Makefiles";}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);

+ 2 - 2
Source/cmGlobalNinjaGenerator.h

@@ -173,11 +173,11 @@ public:
   virtual cmLocalGenerator* CreateLocalGenerator();
 
   /// Overloaded methods. @see cmGlobalGenerator::GetName().
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalNinjaGenerator::GetActualName(); }
 
   /// @return the name of this generator.
-  static const char* GetActualName() { return "Ninja"; }
+  static std::string GetActualName() { return "Ninja"; }
 
   /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
   static void GetDocumentation(cmDocumentationEntry& entry);

+ 2 - 2
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -72,7 +72,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
 {
   // If generating for an extra IDE, the edit_cache target cannot
   // launch a terminal-interactive tool, so always use cmake-gui.
-  if(this->GetExtraGeneratorName())
+  if(!this->GetExtraGeneratorName().empty())
     {
     return cmSystemTools::GetCMakeGUICommand();
     }
@@ -579,7 +579,7 @@ void cmGlobalUnixMakefileGenerator3
 
   // Since we have full control over the invocation of nmake, let us
   // make it quiet.
-  if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
+  if ( this->GetName() == "NMake Makefiles" )
     {
     makeCommand.push_back("/NOLOGO");
     }

+ 2 - 2
Source/cmGlobalUnixMakefileGenerator3.h

@@ -60,9 +60,9 @@ public:
       <cmGlobalUnixMakefileGenerator3>(); }
 
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalUnixMakefileGenerator3::GetActualName();}
-  static const char* GetActualName() {return "Unix Makefiles";}
+  static std::string GetActualName() {return "Unix Makefiles";}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);

+ 13 - 11
Source/cmGlobalVisualStudio10Generator.cxx

@@ -21,13 +21,14 @@
 static const char vs10generatorName[] = "Visual Studio 10 2010";
 
 // Map generator name without year to name with year.
-static const char* cmVS10GenName(const char* name, std::string& genName)
+static const char* cmVS10GenName(const std::string& name, std::string& genName)
 {
-  if(strncmp(name, vs10generatorName, sizeof(vs10generatorName)-6) != 0)
+  if(strncmp(name.c_str(), vs10generatorName,
+             sizeof(vs10generatorName)-6) != 0)
     {
     return 0;
     }
-  const char* p = name + sizeof(vs10generatorName) - 6;
+  const char* p = name.c_str() + sizeof(vs10generatorName) - 6;
   if(cmHasLiteralPrefix(p, " 2010"))
     {
     p += 5;
@@ -40,27 +41,27 @@ class cmGlobalVisualStudio10Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const
+  virtual cmGlobalGenerator* CreateGlobalGenerator(
+                                            const std::string& name) const
     {
     std::string genName;
     const char* p = cmVS10GenName(name, genName);
     if(!p)
       { return 0; }
-    name = genName.c_str();
     if(strcmp(p, "") == 0)
       {
       return new cmGlobalVisualStudio10Generator(
-        name, NULL, NULL);
+        genName, "", "");
       }
     if(strcmp(p, " Win64") == 0)
       {
       return new cmGlobalVisualStudio10Generator(
-        name, "x64", "CMAKE_FORCE_WIN64");
+        genName, "x64", "CMAKE_FORCE_WIN64");
       }
     if(strcmp(p, " IA64") == 0)
       {
       return new cmGlobalVisualStudio10Generator(
-        name, "Itanium", "CMAKE_FORCE_IA64");
+        genName, "Itanium", "CMAKE_FORCE_IA64");
       }
     return 0;
     }
@@ -87,8 +88,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory()
 
 //----------------------------------------------------------------------------
 cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
-  const char* name, const char* platformName,
-  const char* additionalPlatformDefinition)
+  const std::string& name, const std::string& platformName,
+  const std::string& additionalPlatformDefinition)
   : cmGlobalVisualStudio8Generator(name, platformName,
                                    additionalPlatformDefinition)
 {
@@ -102,7 +103,8 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
 
 //----------------------------------------------------------------------------
 bool
-cmGlobalVisualStudio10Generator::MatchesGeneratorName(const char* name) const
+cmGlobalVisualStudio10Generator::MatchesGeneratorName(
+                                               const std::string& name) const
 {
   std::string genName;
   if(cmVS10GenName(name, genName))

+ 4 - 3
Source/cmGlobalVisualStudio10Generator.h

@@ -24,11 +24,12 @@ class cmGlobalVisualStudio10Generator :
   public cmGlobalVisualStudio8Generator
 {
 public:
-  cmGlobalVisualStudio10Generator(const char* name,
-    const char* platformName, const char* additionalPlatformDefinition);
+  cmGlobalVisualStudio10Generator(const std::string& name,
+    const std::string& platformName,
+    const std::string& additionalPlatformDefinition);
   static cmGlobalGeneratorFactory* NewFactory();
 
-  virtual bool MatchesGeneratorName(const char* name) const;
+  virtual bool MatchesGeneratorName(const std::string& name) const;
 
   virtual bool SetGeneratorToolset(std::string const& ts);
 

+ 13 - 11
Source/cmGlobalVisualStudio11Generator.cxx

@@ -16,13 +16,14 @@
 static const char vs11generatorName[] = "Visual Studio 11 2012";
 
 // Map generator name without year to name with year.
-static const char* cmVS11GenName(const char* name, std::string& genName)
+static const char* cmVS11GenName(const std::string& name, std::string& genName)
 {
-  if(strncmp(name, vs11generatorName, sizeof(vs11generatorName)-6) != 0)
+  if(strncmp(name.c_str(), vs11generatorName,
+             sizeof(vs11generatorName)-6) != 0)
     {
     return 0;
     }
-  const char* p = name + sizeof(vs11generatorName) - 6;
+  const char* p = name.c_str() + sizeof(vs11generatorName) - 6;
   if(cmHasLiteralPrefix(p, " 2012"))
     {
     p += 5;
@@ -35,27 +36,27 @@ class cmGlobalVisualStudio11Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const
+  virtual cmGlobalGenerator* CreateGlobalGenerator(
+                                                const std::string& name) const
     {
     std::string genName;
     const char* p = cmVS11GenName(name, genName);
     if(!p)
       { return 0; }
-    name = genName.c_str();
     if(strcmp(p, "") == 0)
       {
       return new cmGlobalVisualStudio11Generator(
-        name, NULL, NULL);
+        genName, "", "");
       }
     if(strcmp(p, " Win64") == 0)
       {
       return new cmGlobalVisualStudio11Generator(
-        name, "x64", "CMAKE_FORCE_WIN64");
+        genName, "x64", "CMAKE_FORCE_WIN64");
       }
     if(strcmp(p, " ARM") == 0)
       {
       return new cmGlobalVisualStudio11Generator(
-        name, "ARM", NULL);
+        genName, "ARM", "");
       }
 
     if(*p++ != ' ')
@@ -107,8 +108,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
 
 //----------------------------------------------------------------------------
 cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
-  const char* name, const char* platformName,
-  const char* additionalPlatformDefinition)
+  const std::string& name, const std::string& platformName,
+  const std::string& additionalPlatformDefinition)
   : cmGlobalVisualStudio10Generator(name, platformName,
                                    additionalPlatformDefinition)
 {
@@ -121,7 +122,8 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
 
 //----------------------------------------------------------------------------
 bool
-cmGlobalVisualStudio11Generator::MatchesGeneratorName(const char* name) const
+cmGlobalVisualStudio11Generator::MatchesGeneratorName(
+                                                const std::string& name) const
 {
   std::string genName;
   if(cmVS11GenName(name, genName))

+ 4 - 3
Source/cmGlobalVisualStudio11Generator.h

@@ -20,11 +20,12 @@ class cmGlobalVisualStudio11Generator:
   public cmGlobalVisualStudio10Generator
 {
 public:
-  cmGlobalVisualStudio11Generator(const char* name,
-    const char* platformName, const char* additionalPlatformDefinition);
+  cmGlobalVisualStudio11Generator(const std::string& name,
+    const std::string& platformName,
+    const std::string& additionalPlatformDefinition);
   static cmGlobalGeneratorFactory* NewFactory();
 
-  virtual bool MatchesGeneratorName(const char* name) const;
+  virtual bool MatchesGeneratorName(const std::string& name) const;
 
   virtual void WriteSLNHeader(std::ostream& fout);
 

+ 13 - 11
Source/cmGlobalVisualStudio12Generator.cxx

@@ -16,13 +16,14 @@
 static const char vs12generatorName[] = "Visual Studio 12 2013";
 
 // Map generator name without year to name with year.
-static const char* cmVS12GenName(const char* name, std::string& genName)
+static const char* cmVS12GenName(const std::string& name, std::string& genName)
 {
-  if(strncmp(name, vs12generatorName, sizeof(vs12generatorName)-6) != 0)
+  if(strncmp(name.c_str(), vs12generatorName,
+             sizeof(vs12generatorName)-6) != 0)
     {
     return 0;
     }
-  const char* p = name + sizeof(vs12generatorName) - 6;
+  const char* p = name.c_str() + sizeof(vs12generatorName) - 6;
   if(cmHasLiteralPrefix(p, " 2013"))
     {
     p += 5;
@@ -35,27 +36,27 @@ class cmGlobalVisualStudio12Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const
+  virtual cmGlobalGenerator* CreateGlobalGenerator(
+                                                const std::string& name) const
     {
     std::string genName;
     const char* p = cmVS12GenName(name, genName);
     if(!p)
       { return 0; }
-    name = genName.c_str();
     if(strcmp(p, "") == 0)
       {
       return new cmGlobalVisualStudio12Generator(
-        name, NULL, NULL);
+        genName, "", "");
       }
     if(strcmp(p, " Win64") == 0)
       {
       return new cmGlobalVisualStudio12Generator(
-        name, "x64", "CMAKE_FORCE_WIN64");
+        genName, "x64", "CMAKE_FORCE_WIN64");
       }
     if(strcmp(p, " ARM") == 0)
       {
       return new cmGlobalVisualStudio12Generator(
-        name, "ARM", NULL);
+        genName, "ARM", "");
       }
     return 0;
     }
@@ -82,8 +83,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory()
 
 //----------------------------------------------------------------------------
 cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
-  const char* name, const char* platformName,
-  const char* additionalPlatformDefinition)
+  const std::string& name, const std::string& platformName,
+  const std::string& additionalPlatformDefinition)
   : cmGlobalVisualStudio11Generator(name, platformName,
                                    additionalPlatformDefinition)
 {
@@ -96,7 +97,8 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
 
 //----------------------------------------------------------------------------
 bool
-cmGlobalVisualStudio12Generator::MatchesGeneratorName(const char* name) const
+cmGlobalVisualStudio12Generator::MatchesGeneratorName(
+                                                const std::string& name) const
 {
   std::string genName;
   if(cmVS12GenName(name, genName))

+ 4 - 3
Source/cmGlobalVisualStudio12Generator.h

@@ -20,11 +20,12 @@ class cmGlobalVisualStudio12Generator:
   public cmGlobalVisualStudio11Generator
 {
 public:
-  cmGlobalVisualStudio12Generator(const char* name,
-    const char* platformName, const char* additionalPlatformDefinition);
+  cmGlobalVisualStudio12Generator(const std::string& name,
+    const std::string& platformName,
+    const std::string& additionalPlatformDefinition);
   static cmGlobalGeneratorFactory* NewFactory();
 
-  virtual bool MatchesGeneratorName(const char* name) const;
+  virtual bool MatchesGeneratorName(const std::string& name) const;
 
   virtual void WriteSLNHeader(std::ostream& fout);
 

+ 2 - 2
Source/cmGlobalVisualStudio6Generator.h

@@ -31,9 +31,9 @@ public:
       <cmGlobalVisualStudio6Generator>(); }
 
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalVisualStudio6Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 6";}
+  static std::string GetActualName() {return "Visual Studio 6";}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);

+ 5 - 4
Source/cmGlobalVisualStudio71Generator.cxx

@@ -17,7 +17,8 @@
 
 //----------------------------------------------------------------------------
 cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(
-  const char* platformName) : cmGlobalVisualStudio7Generator(platformName)
+  const std::string& platformName)
+  : cmGlobalVisualStudio7Generator(platformName)
 {
   this->ProjectConfigurationSectionName = "ProjectConfiguration";
 }
@@ -279,10 +280,10 @@ void cmGlobalVisualStudio71Generator
 ::WriteProjectConfigurations(
   std::ostream& fout, const std::string& name, cmTarget::TargetType,
   const std::set<std::string>& configsPartOfDefaultBuild,
-  const char* platformMapping)
+  std::string const& platformMapping)
 {
-  const char* platformName =
-    platformMapping ? platformMapping : this->GetPlatformName();
+  const std::string& platformName =
+    !platformMapping.empty() ? platformMapping : this->GetPlatformName();
   std::string guid = this->GetGUID(name);
   for(std::vector<std::string>::iterator i = this->Configurations.begin();
       i != this->Configurations.end(); ++i)

+ 4 - 4
Source/cmGlobalVisualStudio71Generator.h

@@ -23,15 +23,15 @@
 class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator
 {
 public:
-  cmGlobalVisualStudio71Generator(const char* platformName = NULL);
+  cmGlobalVisualStudio71Generator(const std::string& platformName = "");
   static cmGlobalGeneratorFactory* NewFactory() {
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalVisualStudio71Generator>(); }
 
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalVisualStudio71Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 7 .NET 2003";}
+  static std::string GetActualName() {return "Visual Studio 7 .NET 2003";}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);
@@ -67,7 +67,7 @@ protected:
   virtual void WriteProjectConfigurations(
     std::ostream& fout, const std::string& name, cmTarget::TargetType type,
     const std::set<std::string>& configsPartOfDefaultBuild,
-    const char* platformMapping = NULL);
+    const std::string& platformMapping = "");
   virtual void WriteExternalProject(std::ostream& fout,
                                     const std::string& name,
                                     const char* path,

+ 13 - 9
Source/cmGlobalVisualStudio7Generator.cxx

@@ -19,16 +19,19 @@
 #include <cmsys/Encoding.hxx>
 
 cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
-  const char* platformName)
+  const std::string& platformName)
 {
   this->IntelProjectVersion = 0;
   this->DevEnvCommandInitialized = false;
 
-  if (!platformName)
+  if (platformName.empty())
     {
-    platformName = "Win32";
+    this->PlatformName = "Win32";
+    }
+  else
+    {
+    this->PlatformName = platformName;
     }
-  this->PlatformName = platformName;
 }
 
 cmGlobalVisualStudio7Generator::~cmGlobalVisualStudio7Generator()
@@ -260,7 +263,7 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator()
 void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf)
 {
   cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf);
-  mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName());
+  mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str());
   mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION",
                     this->GetIntelProjectVersion());
 }
@@ -381,9 +384,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
       {
       std::set<std::string> allConfigurations(this->Configurations.begin(),
                                               this->Configurations.end());
+      const char* mapping = target->GetProperty("VS_PLATFORM_MAPPING");
       this->WriteProjectConfigurations(
         fout, target->GetName().c_str(), target->GetType(),
-        allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING"));
+        allConfigurations, mapping ? mapping : "");
       }
     else
       {
@@ -732,10 +736,10 @@ void cmGlobalVisualStudio7Generator
 ::WriteProjectConfigurations(
   std::ostream& fout, const std::string& name, cmTarget::TargetType,
   const std::set<std::string>& configsPartOfDefaultBuild,
-  const char* platformMapping)
+  const std::string& platformMapping)
 {
-  const char* platformName =
-    platformMapping ? platformMapping : this->GetPlatformName();
+  const std::string& platformName =
+    !platformMapping.empty() ? platformMapping : this->GetPlatformName();
   std::string guid = this->GetGUID(name);
   for(std::vector<std::string>::iterator i = this->Configurations.begin();
       i != this->Configurations.end(); ++i)

+ 5 - 5
Source/cmGlobalVisualStudio7Generator.h

@@ -26,7 +26,7 @@ struct cmIDEFlagTable;
 class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
 {
 public:
-  cmGlobalVisualStudio7Generator(const char* platformName = NULL);
+  cmGlobalVisualStudio7Generator(const std::string& platformName = "");
   ~cmGlobalVisualStudio7Generator();
 
   static cmGlobalGeneratorFactory* NewFactory() {
@@ -34,12 +34,12 @@ public:
       <cmGlobalVisualStudio7Generator>(); }
 
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalVisualStudio7Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 7";}
+  static std::string GetActualName() {return "Visual Studio 7";}
 
   ///! Get the name for the platform.
-  const char* GetPlatformName() const { return this->PlatformName.c_str(); }
+  const std::string& GetPlatformName() const { return this->PlatformName; }
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();
@@ -131,7 +131,7 @@ protected:
   virtual void WriteProjectConfigurations(
     std::ostream& fout, const std::string& name, cmTarget::TargetType type,
     const std::set<std::string>& configsPartOfDefaultBuild,
-    const char* platformMapping = NULL);
+    const std::string& platformMapping = "");
   virtual void WriteSLNGlobalSections(std::ostream& fout,
                                       cmLocalGenerator* root);
   virtual void WriteSLNFooter(std::ostream& fout);

+ 17 - 12
Source/cmGlobalVisualStudio8Generator.cxx

@@ -23,17 +23,19 @@ class cmGlobalVisualStudio8Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
-    if(strstr(name, vs8generatorName) != name)
+  virtual cmGlobalGenerator* CreateGlobalGenerator(
+                                              const std::string& name) const {
+    if(strncmp(name.c_str(), vs8generatorName,
+               sizeof(vs8generatorName) - 1) != 0)
       {
       return 0;
       }
 
-    const char* p = name + sizeof(vs8generatorName) - 1;
+    const char* p = name.c_str() + sizeof(vs8generatorName) - 1;
     if(p[0] == '\0')
       {
       return new cmGlobalVisualStudio8Generator(
-        name, NULL, NULL);
+        name, "", "");
       }
 
     if(p[0] != ' ')
@@ -57,7 +59,7 @@ public:
       }
 
     cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator(
-      name, p, NULL);
+      name, p, "");
     ret->WindowsCEVersion = parser.GetOSVersion();
     return ret;
   }
@@ -90,14 +92,14 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory()
 
 //----------------------------------------------------------------------------
 cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
-  const char* name, const char* platformName,
-  const char* additionalPlatformDefinition)
+  const std::string& name, const std::string& platformName,
+  const std::string& additionalPlatformDefinition)
   : cmGlobalVisualStudio71Generator(platformName)
 {
   this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
   this->Name = name;
 
-  if (additionalPlatformDefinition)
+  if (!additionalPlatformDefinition.empty())
     {
     this->AdditionalPlatformDefinition = additionalPlatformDefinition;
     }
@@ -374,7 +376,7 @@ cmGlobalVisualStudio8Generator
 ::WriteProjectConfigurations(
   std::ostream& fout, const std::string& name, cmTarget::TargetType type,
   const std::set<std::string>& configsPartOfDefaultBuild,
-  const char* platformMapping)
+  std::string const& platformMapping)
 {
   std::string guid = this->GetGUID(name);
   for(std::vector<std::string>::iterator i = this->Configurations.begin();
@@ -382,7 +384,8 @@ cmGlobalVisualStudio8Generator
     {
     fout << "\t\t{" << guid << "}." << *i
          << "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|"
-         << (platformMapping ? platformMapping : this->GetPlatformName())
+         << (!platformMapping.empty()?
+             platformMapping : this->GetPlatformName())
          << "\n";
       std::set<std::string>::const_iterator
         ci = configsPartOfDefaultBuild.find(*i);
@@ -390,7 +393,8 @@ cmGlobalVisualStudio8Generator
       {
       fout << "\t\t{" << guid << "}." << *i
            << "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|"
-           << (platformMapping ? platformMapping : this->GetPlatformName())
+           << (!platformMapping.empty()?
+               platformMapping : this->GetPlatformName())
            << "\n";
       }
     bool needsDeploy = (type == cmTarget::EXECUTABLE ||
@@ -399,7 +403,8 @@ cmGlobalVisualStudio8Generator
       {
       fout << "\t\t{" << guid << "}." << *i
            << "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
-           << (platformMapping ? platformMapping : this->GetPlatformName())
+           << (!platformMapping.empty()?
+               platformMapping : this->GetPlatformName())
            << "\n";
       }
     }

+ 5 - 4
Source/cmGlobalVisualStudio8Generator.h

@@ -23,12 +23,13 @@
 class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator
 {
 public:
-  cmGlobalVisualStudio8Generator(const char* name,
-    const char* platformName, const char* additionalPlatformDefinition);
+  cmGlobalVisualStudio8Generator(const std::string& name,
+    const std::string& platformName,
+    const std::string& additionalPlatformDefinition);
   static cmGlobalGeneratorFactory* NewFactory();
 
   ///! Get the name for the generator.
-  virtual const char* GetName() const {return this->Name.c_str();}
+  virtual std::string GetName() const {return this->Name;}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);
@@ -81,7 +82,7 @@ protected:
   virtual void WriteProjectConfigurations(
     std::ostream& fout, const std::string& name, cmTarget::TargetType type,
     const std::set<std::string>& configsPartOfDefaultBuild,
-    const char* platformMapping = NULL);
+    const std::string& platformMapping = "");
   virtual bool ComputeTargetDepends();
   virtual void WriteProjectDepends(std::ostream& fout,
                                    const std::string& name,

+ 8 - 6
Source/cmGlobalVisualStudio9Generator.cxx

@@ -22,17 +22,19 @@ class cmGlobalVisualStudio9Generator::Factory
   : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
-    if(strstr(name, vs9generatorName) != name)
+  virtual cmGlobalGenerator* CreateGlobalGenerator(
+                                              const std::string& name) const {
+    if(strncmp(name.c_str(), vs9generatorName,
+               sizeof(vs9generatorName) - 1) != 0)
       {
       return 0;
       }
 
-    const char* p = name + sizeof(vs9generatorName) - 1;
+    const char* p = name.c_str() + sizeof(vs9generatorName) - 1;
     if(p[0] == '\0')
       {
       return new cmGlobalVisualStudio9Generator(
-        name, NULL, NULL);
+        name, "", "");
       }
 
     if(p[0] != ' ')
@@ -96,8 +98,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory()
 
 //----------------------------------------------------------------------------
 cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(
-  const char* name, const char* platformName,
-  const char* additionalPlatformDefinition)
+  const std::string& name, const std::string& platformName,
+  const std::string& additionalPlatformDefinition)
   : cmGlobalVisualStudio8Generator(name, platformName,
                                    additionalPlatformDefinition)
 {

+ 3 - 2
Source/cmGlobalVisualStudio9Generator.h

@@ -24,8 +24,9 @@ class cmGlobalVisualStudio9Generator :
   public cmGlobalVisualStudio8Generator
 {
 public:
-  cmGlobalVisualStudio9Generator(const char* name,
-    const char* platformName, const char* additionalPlatformDefinition);
+  cmGlobalVisualStudio9Generator(const std::string& name,
+    const std::string& platformName,
+    const std::string& additionalPlatformDefinition);
   static cmGlobalGeneratorFactory* NewFactory();
 
   ///! create the correct local generator

+ 2 - 2
Source/cmGlobalVisualStudioGenerator.cxx

@@ -22,7 +22,7 @@
 //----------------------------------------------------------------------------
 cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator()
 {
-  this->AdditionalPlatformDefinition = NULL;
+  this->AdditionalPlatformDefinition = "";
 }
 
 //----------------------------------------------------------------------------
@@ -518,7 +518,7 @@ void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf)
 {
-  if(this->AdditionalPlatformDefinition)
+  if(!this->AdditionalPlatformDefinition.empty())
     {
     mf->AddDefinition(this->AdditionalPlatformDefinition, "TRUE");
     }

+ 1 - 1
Source/cmGlobalVisualStudioGenerator.h

@@ -110,7 +110,7 @@ protected:
   std::string GetUtilityDepend(cmTarget const* target);
   typedef std::map<cmTarget const*, std::string> UtilityDependsMap;
   UtilityDependsMap UtilityDepends;
-  const char* AdditionalPlatformDefinition;
+  std::string AdditionalPlatformDefinition;
 
 private:
   virtual std::string GetVSMakeProgram() = 0;

+ 2 - 2
Source/cmGlobalWatcomWMakeGenerator.h

@@ -27,9 +27,9 @@ public:
     return new cmGlobalGeneratorSimpleFactory
       <cmGlobalWatcomWMakeGenerator>(); }
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalWatcomWMakeGenerator::GetActualName();}
-  static const char* GetActualName() {return "Watcom WMake";}
+  static std::string GetActualName() {return "Watcom WMake";}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);

+ 4 - 3
Source/cmGlobalXCodeGenerator.cxx

@@ -116,7 +116,8 @@ public:
 class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
 {
 public:
-  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const;
+  virtual cmGlobalGenerator* CreateGlobalGenerator(
+                                              const std::string& name) const;
 
   virtual void GetDocumentation(cmDocumentationEntry& entry) const {
     cmGlobalXCodeGenerator::GetDocumentation(entry); }
@@ -152,9 +153,9 @@ cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory()
 
 //----------------------------------------------------------------------------
 cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
-::CreateGlobalGenerator(const char* name) const
+::CreateGlobalGenerator(const std::string& name) const
 {
-  if (strcmp(name, GetActualName()))
+  if (name != GetActualName())
     return 0;
 #if defined(CMAKE_BUILD_WITH_CMAKE)
   cmXcodeVersionParser parser;

+ 2 - 2
Source/cmGlobalXCodeGenerator.h

@@ -33,9 +33,9 @@ public:
   static cmGlobalGeneratorFactory* NewFactory();
 
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
+  virtual std::string GetName() const {
     return cmGlobalXCodeGenerator::GetActualName();}
-  static const char* GetActualName() {return "Xcode";}
+  static std::string GetActualName() {return "Xcode";}
 
   /** Get the documentation entry for this generator.  */
   static void GetDocumentation(cmDocumentationEntry& entry);

+ 1 - 1
Source/cmLocalVisualStudio7Generator.h

@@ -53,7 +53,7 @@ public:
    */
   void SetBuildType(BuildType,const std::string& name);
 
-  void SetPlatformName(const char* n) { this->PlatformName = n;}
+  void SetPlatformName(const std::string& n) { this->PlatformName = n;}
 
   void SetExtraFlagTable(cmVS7FlagTable const* table)
     { this->ExtraFlagTable = table; }

+ 2 - 2
Source/cmMakefile.cxx

@@ -1378,8 +1378,8 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
 
   // VS6 IDE does not support definition values with spaces in
   // combination with '"', '$', or ';'.
-  if((strcmp(this->LocalGenerator->GetGlobalGenerator()->GetName(),
-             "Visual Studio 6") == 0) &&
+  if((this->LocalGenerator->GetGlobalGenerator()->GetName() ==
+             "Visual Studio 6") &&
      (def.find(" ") != def.npos && def.find_first_of("\"$;") != def.npos))
     {
     return false;

+ 1 - 1
Source/cmQtAutoGenerators.cxx

@@ -251,7 +251,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
   bool usePRE_BUILD = false;
   cmLocalGenerator* localGen = makefile->GetLocalGenerator();
   cmGlobalGenerator* gg = localGen->GetGlobalGenerator();
-  if(strstr(gg->GetName(), "Visual Studio"))
+  if(gg->GetName().find("Visual Studio") != std::string::npos)
     {
     cmLocalVisualStudioGenerator* vslg =
       static_cast<cmLocalVisualStudioGenerator*>(localGen);

+ 9 - 7
Source/cmake.cxx

@@ -965,7 +965,7 @@ int cmake::AddCMakePaths()
   return 1;
 }
 
-void cmake::AddExtraGenerator(const char* name,
+void cmake::AddExtraGenerator(const std::string& name,
                               CreateExtraGeneratorFunctionType newFunction)
 {
   cmExternalMakefileProjectGenerator* extraGenerator = newFunction();
@@ -1034,9 +1034,10 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
     }
 }
 
-cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name)
+cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
 {
   cmExternalMakefileProjectGenerator* extraGenerator = 0;
+  std::string name = gname;
   RegisteredExtraGeneratorsMap::const_iterator extraGenIt =
                                             this->ExtraGenerators.find(name);
   if (extraGenIt != this->ExtraGenerators.end())
@@ -1324,7 +1325,8 @@ int cmake::ActualConfigure()
     if(genName)
       {
       std::string fullName = cmExternalMakefileProjectGenerator::
-                                CreateFullGeneratorName(genName, extraGenName);
+                                CreateFullGeneratorName(genName,
+                                    extraGenName ? extraGenName : "");
       this->GlobalGenerator = this->CreateGlobalGenerator(fullName.c_str());
       }
     if(this->GlobalGenerator)
@@ -1417,13 +1419,13 @@ int cmake::ActualConfigure()
   if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR"))
     {
     this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
-                                      this->GlobalGenerator->GetName(),
+                                      this->GlobalGenerator->GetName().c_str(),
                                       "Name of generator.",
                                       cmCacheManager::INTERNAL);
     this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
-                                this->GlobalGenerator->GetExtraGeneratorName(),
-                                "Name of external makefile project generator.",
-                                cmCacheManager::INTERNAL);
+                        this->GlobalGenerator->GetExtraGeneratorName().c_str(),
+                        "Name of external makefile project generator.",
+                        cmCacheManager::INTERNAL);
     }
 
   if(const char* tsName =

+ 2 - 2
Source/cmake.h

@@ -175,7 +175,7 @@ class cmake
   void PreLoadCMakeFiles();
 
   ///! Create a GlobalGenerator
-  cmGlobalGenerator* CreateGlobalGenerator(const char* name);
+  cmGlobalGenerator* CreateGlobalGenerator(const std::string& name);
 
   ///! Return the global generator assigned to this instance of cmake
   cmGlobalGenerator* GetGlobalGenerator()     { return this->GlobalGenerator; }
@@ -380,7 +380,7 @@ protected:
   void AddDefaultCommands();
   void AddDefaultGenerators();
   void AddDefaultExtraGenerators();
-  void AddExtraGenerator(const char* name,
+  void AddExtraGenerator(const std::string& name,
                          CreateExtraGeneratorFunctionType newFunction);
 
   cmPolicies *Policies;