stringapi: Use strings for generator names

This commit is contained in:
Ben Boeckel 2014-02-24 17:36:27 -05:00 committed by Brad King
parent 24b5e93de2
commit 1a1b737c99
52 changed files with 221 additions and 190 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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) void cmGlobalGenerator::FileReplacedDuringGenerate(const std::string& filename)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,7 +53,7 @@ public:
*/ */
void SetBuildType(BuildType,const std::string& name); 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) void SetExtraFlagTable(cmVS7FlagTable const* table)
{ this->ExtraFlagTable = table; } { this->ExtraFlagTable = table; }

View File

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

View File

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

View File

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

View File

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