summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio10Generator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx51
1 files changed, 27 insertions, 24 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 6983ef9..37a416b 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/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))
@@ -310,11 +312,11 @@ std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand()
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* projectDir,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions)
{
@@ -334,7 +336,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
cmSlnData slnData;
{
std::string slnFile;
- if(projectDir && *projectDir)
+ if(!projectDir.empty())
{
slnFile = projectDir;
slnFile += "/";
@@ -369,25 +371,26 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
makeCommand.push_back(makeProgramSelected);
+ std::string realTarget = targetName;
// msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD
- if(!targetName || strlen(targetName) == 0)
+ if(realTarget.empty())
{
- targetName = "ALL_BUILD";
+ realTarget = "ALL_BUILD";
}
- if ( targetName && strcmp(targetName, "clean") == 0 )
+ if ( realTarget == "clean" )
{
makeCommand.push_back(std::string(projectName)+".sln");
makeCommand.push_back("/t:Clean");
}
else
{
- std::string targetProject(targetName);
+ std::string targetProject(realTarget);
targetProject += ".vcxproj";
if (targetProject.find('/') == std::string::npos)
{
// it might be in a subdir
if (cmSlnProjectEntry const* proj =
- slnData.GetProjectByName(targetName))
+ slnData.GetProjectByName(realTarget))
{
targetProject = proj->GetRelativePath();
cmSystemTools::ConvertToUnixSlashes(targetProject);
@@ -396,7 +399,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
makeCommand.push_back(targetProject);
}
std::string configArg = "/p:Configuration=";
- if(config && strlen(config))
+ if(!config.empty())
{
configArg += config;
}
@@ -467,7 +470,7 @@ cmGlobalVisualStudio10Generator
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::PathTooLong(
- cmTarget* target, cmSourceFile* sf, std::string const& sfRel)
+ cmTarget* target, cmSourceFile const* sf, std::string const& sfRel)
{
size_t len = (strlen(target->GetMakefile()->GetCurrentOutputDirectory()) +
1 + sfRel.length());