Commit 24b5e93d authored by Ben Boeckel's avatar Ben Boeckel Committed by Brad King
Browse files

stringapi: Use strings for directories

parent 11ed3e2c
......@@ -1614,7 +1614,8 @@ void cmGlobalGenerator::CheckLocalGenerators()
}
}
int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
int cmGlobalGenerator::TryCompile(const std::string& srcdir,
const std::string& bindir,
const std::string& projectName,
const std::string& target, bool fast,
std::string *output, cmMakefile *mf)
......@@ -1665,7 +1666,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
void cmGlobalGenerator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, const char*, const std::string&,
const char*, const std::string&, const std::string&, bool,
const std::string&, const std::string&, const std::string&, bool,
std::vector<std::string> const&)
{
makeCommand.push_back(
......@@ -1673,7 +1674,7 @@ void cmGlobalGenerator::GenerateBuildCommand(
}
int cmGlobalGenerator::Build(
const char *, const char *bindir,
const std::string&, const std::string& bindir,
const std::string& projectName, const std::string& target,
std::string *output,
const char *makeCommandCSTR,
......@@ -1687,7 +1688,7 @@ int cmGlobalGenerator::Build(
* Run an executable command and put the stdout in output.
*/
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(bindir);
cmSystemTools::ChangeDirectory(bindir.c_str());
if(output)
{
*output += "Change Dir: ";
......
......@@ -105,7 +105,7 @@ public:
* Try running cmake and building a file. This is used for dynamically
* loaded commands, not as part of the usual build process.
*/
virtual int TryCompile(const char *srcdir, const char *bindir,
virtual int TryCompile(const std::string& srcdir, const std::string& bindir,
const std::string& projectName,
const std::string& targetName,
bool fast, std::string *output, cmMakefile* mf);
......@@ -117,7 +117,7 @@ public:
* empty then all is assumed. clean indicates if a "make clean" should be
* done first.
*/
int Build(const char *srcdir, const char *bindir,
int Build(const std::string& srcdir, const std::string& bindir,
const std::string& projectName, const std::string& targetName,
std::string *output,
const char *makeProgram, const std::string& config,
......@@ -130,7 +130,7 @@ public:
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName, const char *projectDir,
const std::string& projectName, const std::string& projectDir,
const std::string& targetName, const std::string& config, bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
......
......@@ -553,7 +553,7 @@ void cmGlobalNinjaGenerator
::GenerateBuildCommand(std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& /*projectName*/,
const char* /*projectDir*/,
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& /*config*/,
bool /*fast*/,
......
......@@ -195,7 +195,7 @@ public:
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName,
const char* projectDir,
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
......
......@@ -567,7 +567,7 @@ void cmGlobalUnixMakefileGenerator3
::GenerateBuildCommand(std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& /*projectName*/,
const char* /*projectDir*/,
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& /*config*/,
bool fast,
......
......@@ -111,7 +111,7 @@ public:
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName,
const char* projectDir,
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
......
......@@ -312,7 +312,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName,
const char* projectDir,
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
......@@ -334,7 +334,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
cmSlnData slnData;
{
std::string slnFile;
if(projectDir && *projectDir)
if(!projectDir.empty())
{
slnFile = projectDir;
slnFile += "/";
......
......@@ -36,7 +36,7 @@ public:
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName,
const char* projectDir,
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
......
......@@ -118,7 +118,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName,
const char* /*projectDir*/,
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& config,
bool /*fast*/,
......
......@@ -56,7 +56,7 @@ public:
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName,
const char* projectDir,
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
......
......@@ -185,7 +185,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName,
const char* /*projectDir*/,
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& config,
bool /*fast*/,
......
......@@ -64,7 +64,7 @@ public:
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName,
const char* projectDir,
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
......
......@@ -262,7 +262,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName,
const char* /*projectDir*/,
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& config,
bool /*fast*/,
......
......@@ -57,7 +57,7 @@ public:
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName,
const char* projectDir,
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
......
......@@ -3060,7 +3060,8 @@ void cmMakefile::ExpandSourceListArguments(
}
}
int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
int cmMakefile::TryCompile(const std::string& srcdir,
const std::string& bindir,
const std::string& projectName,
const std::string& targetName,
bool fast,
......@@ -3069,15 +3070,15 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
{
this->Internal->IsSourceFileTryCompile = fast;
// does the binary directory exist ? If not create it...
if (!cmSystemTools::FileIsDirectory(bindir))
if (!cmSystemTools::FileIsDirectory(bindir.c_str()))
{
cmSystemTools::MakeDirectory(bindir);
cmSystemTools::MakeDirectory(bindir.c_str());
}
// change to the tests directory and run cmake
// use the cmake object instead of calling cmake
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(bindir);
cmSystemTools::ChangeDirectory(bindir.c_str());
// make sure the same generator is used
// use this program as the cmake to be run, it should not
......
......@@ -126,7 +126,7 @@ public:
* Try running cmake and building a file. This is used for dynalically
* loaded commands, not as part of the usual build process.
*/
int TryCompile(const char *srcdir, const char *bindir,
int TryCompile(const std::string& srcdir, const std::string& bindir,
const std::string& projectName, const std::string& targetName,
bool fast,
const std::vector<std::string> *cmakeArgs,
......
......@@ -952,7 +952,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
}
static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
const char* targetDirectory)
const std::string& targetDirectory)
{
cmGlobalGenerator* gg = new cmGlobalGenerator();
gg->SetCMakeInstance(cm);
......@@ -967,7 +967,7 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
return gg;
}
bool cmQtAutoGenerators::Run(const char* targetDirectory,
bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
const std::string& config)
{
bool success = true;
......@@ -994,10 +994,11 @@ bool cmQtAutoGenerators::Run(const char* targetDirectory,
}
bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
const char* targetDirectory,
const std::string& targetDirectory,
const std::string& config)
{
std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
std::string filename(
cmSystemTools::CollapseFullPath(targetDirectory.c_str()));
cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutogenInfo.cmake";
......@@ -1137,9 +1138,10 @@ std::string cmQtAutoGenerators::MakeCompileSettingsString(cmMakefile* makefile)
bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile,
const char* targetDirectory)
const std::string& targetDirectory)
{
std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
std::string filename(
cmSystemTools::CollapseFullPath(targetDirectory.c_str()));
cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutomocOldMocDefinitions.cmake";
......@@ -1153,9 +1155,11 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile,
void
cmQtAutoGenerators::WriteOldMocDefinitionsFile(const char* targetDirectory)
cmQtAutoGenerators::WriteOldMocDefinitionsFile(
const std::string& targetDirectory)
{
std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
std::string filename(
cmSystemTools::CollapseFullPath(targetDirectory.c_str()));
cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutomocOldMocDefinitions.cmake";
......
......@@ -21,7 +21,7 @@ class cmQtAutoGenerators
{
public:
cmQtAutoGenerators();
bool Run(const char* targetDirectory, const std::string& config);
bool Run(const std::string& targetDirectory, const std::string& config);
bool InitializeAutogenTarget(cmTarget* target);
void SetupAutoGenerateTarget(cmTarget const* target);
......@@ -37,11 +37,11 @@ private:
void SetupAutoRccTarget(cmTarget const* target);
bool ReadAutogenInfoFile(cmMakefile* makefile,
const char* targetDirectory,
const std::string& targetDirectory,
const std::string& config);
bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
const char* targetDirectory);
void WriteOldMocDefinitionsFile(const char* targetDirectory);
const std::string& targetDirectory);
void WriteOldMocDefinitionsFile(const std::string& targetDirectory);
std::string MakeCompileSettingsString(cmMakefile* makefile);
......
......@@ -2667,7 +2667,7 @@ int cmake::Build(const std::string& dir,
return 1;
}
projName = it.GetValue();
return gen->Build(0, dir.c_str(),
return gen->Build("", dir.c_str(),
projName.c_str(), target.c_str(),
&output,
0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment