stringapi: Use strings for directories

This commit is contained in:
Ben Boeckel 2014-02-24 17:38:30 -05:00 committed by Brad King
parent 11ed3e2cfe
commit 24b5e93de2
19 changed files with 44 additions and 38 deletions

View File

@ -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& projectName,
const std::string& target, bool fast, const std::string& target, bool fast,
std::string *output, cmMakefile *mf) std::string *output, cmMakefile *mf)
@ -1665,7 +1666,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
void cmGlobalGenerator::GenerateBuildCommand( void cmGlobalGenerator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, const char*, const std::string&, 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&) std::vector<std::string> const&)
{ {
makeCommand.push_back( makeCommand.push_back(
@ -1673,7 +1674,7 @@ void cmGlobalGenerator::GenerateBuildCommand(
} }
int cmGlobalGenerator::Build( int cmGlobalGenerator::Build(
const char *, const char *bindir, const std::string&, const std::string& bindir,
const std::string& projectName, const std::string& target, const std::string& projectName, const std::string& target,
std::string *output, std::string *output,
const char *makeCommandCSTR, const char *makeCommandCSTR,
@ -1687,7 +1688,7 @@ int cmGlobalGenerator::Build(
* Run an executable command and put the stdout in output. * Run an executable command and put the stdout in output.
*/ */
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(bindir); cmSystemTools::ChangeDirectory(bindir.c_str());
if(output) if(output)
{ {
*output += "Change Dir: "; *output += "Change Dir: ";

View File

@ -105,7 +105,7 @@ public:
* Try running cmake and building a file. This is used for dynamically * Try running cmake and building a file. This is used for dynamically
* loaded commands, not as part of the usual build process. * 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& projectName,
const std::string& targetName, const std::string& targetName,
bool fast, std::string *output, cmMakefile* mf); 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 * empty then all is assumed. clean indicates if a "make clean" should be
* done first. * 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, const std::string& projectName, const std::string& targetName,
std::string *output, std::string *output,
const char *makeProgram, const std::string& config, const char *makeProgram, const std::string& config,
@ -130,7 +130,7 @@ public:
virtual void GenerateBuildCommand( virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, 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, const std::string& targetName, const std::string& config, bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>() std::vector<std::string> const& makeOptions = std::vector<std::string>()
); );

View File

@ -553,7 +553,7 @@ void cmGlobalNinjaGenerator
::GenerateBuildCommand(std::vector<std::string>& makeCommand, ::GenerateBuildCommand(std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& /*projectName*/, const std::string& /*projectName*/,
const char* /*projectDir*/, const std::string& /*projectDir*/,
const std::string& targetName, const std::string& targetName,
const std::string& /*config*/, const std::string& /*config*/,
bool /*fast*/, bool /*fast*/,

View File

@ -195,7 +195,7 @@ public:
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& projectName, const std::string& projectName,
const char* projectDir, const std::string& projectDir,
const std::string& targetName, const std::string& targetName,
const std::string& config, const std::string& config,
bool fast, bool fast,

View File

@ -567,7 +567,7 @@ void cmGlobalUnixMakefileGenerator3
::GenerateBuildCommand(std::vector<std::string>& makeCommand, ::GenerateBuildCommand(std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& /*projectName*/, const std::string& /*projectName*/,
const char* /*projectDir*/, const std::string& /*projectDir*/,
const std::string& targetName, const std::string& targetName,
const std::string& /*config*/, const std::string& /*config*/,
bool fast, bool fast,

View File

@ -111,7 +111,7 @@ public:
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& projectName, const std::string& projectName,
const char* projectDir, const std::string& projectDir,
const std::string& targetName, const std::string& targetName,
const std::string& config, const std::string& config,
bool fast, bool fast,

View File

@ -312,7 +312,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& projectName, const std::string& projectName,
const char* projectDir, const std::string& projectDir,
const std::string& targetName, const std::string& targetName,
const std::string& config, const std::string& config,
bool fast, bool fast,
@ -334,7 +334,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
cmSlnData slnData; cmSlnData slnData;
{ {
std::string slnFile; std::string slnFile;
if(projectDir && *projectDir) if(!projectDir.empty())
{ {
slnFile = projectDir; slnFile = projectDir;
slnFile += "/"; slnFile += "/";

View File

@ -36,7 +36,7 @@ public:
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& projectName, const std::string& projectName,
const char* projectDir, const std::string& projectDir,
const std::string& targetName, const std::string& targetName,
const std::string& config, const std::string& config,
bool fast, bool fast,

View File

@ -118,7 +118,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& projectName, const std::string& projectName,
const char* /*projectDir*/, const std::string& /*projectDir*/,
const std::string& targetName, const std::string& targetName,
const std::string& config, const std::string& config,
bool /*fast*/, bool /*fast*/,

View File

@ -56,7 +56,7 @@ public:
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& projectName, const std::string& projectName,
const char* projectDir, const std::string& projectDir,
const std::string& targetName, const std::string& targetName,
const std::string& config, const std::string& config,
bool fast, bool fast,

View File

@ -185,7 +185,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& projectName, const std::string& projectName,
const char* /*projectDir*/, const std::string& /*projectDir*/,
const std::string& targetName, const std::string& targetName,
const std::string& config, const std::string& config,
bool /*fast*/, bool /*fast*/,

View File

@ -64,7 +64,7 @@ public:
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& projectName, const std::string& projectName,
const char* projectDir, const std::string& projectDir,
const std::string& targetName, const std::string& targetName,
const std::string& config, const std::string& config,
bool fast, bool fast,

View File

@ -262,7 +262,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& projectName, const std::string& projectName,
const char* /*projectDir*/, const std::string& /*projectDir*/,
const std::string& targetName, const std::string& targetName,
const std::string& config, const std::string& config,
bool /*fast*/, bool /*fast*/,

View File

@ -57,7 +57,7 @@ public:
std::vector<std::string>& makeCommand, std::vector<std::string>& makeCommand,
const char* makeProgram, const char* makeProgram,
const std::string& projectName, const std::string& projectName,
const char* projectDir, const std::string& projectDir,
const std::string& targetName, const std::string& targetName,
const std::string& config, const std::string& config,
bool fast, bool fast,

View File

@ -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& projectName,
const std::string& targetName, const std::string& targetName,
bool fast, bool fast,
@ -3069,15 +3070,15 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
{ {
this->Internal->IsSourceFileTryCompile = fast; this->Internal->IsSourceFileTryCompile = fast;
// does the binary directory exist ? If not create it... // 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 // change to the tests directory and run cmake
// use the cmake object instead of calling cmake // use the cmake object instead of calling cmake
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(bindir); cmSystemTools::ChangeDirectory(bindir.c_str());
// make sure the same generator is used // make sure the same generator is used
// use this program as the cmake to be run, it should not // use this program as the cmake to be run, it should not

View File

@ -126,7 +126,7 @@ public:
* Try running cmake and building a file. This is used for dynalically * Try running cmake and building a file. This is used for dynalically
* loaded commands, not as part of the usual build process. * 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, const std::string& projectName, const std::string& targetName,
bool fast, bool fast,
const std::vector<std::string> *cmakeArgs, const std::vector<std::string> *cmakeArgs,

View File

@ -952,7 +952,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
} }
static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
const char* targetDirectory) const std::string& targetDirectory)
{ {
cmGlobalGenerator* gg = new cmGlobalGenerator(); cmGlobalGenerator* gg = new cmGlobalGenerator();
gg->SetCMakeInstance(cm); gg->SetCMakeInstance(cm);
@ -967,7 +967,7 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
return gg; return gg;
} }
bool cmQtAutoGenerators::Run(const char* targetDirectory, bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
const std::string& config) const std::string& config)
{ {
bool success = true; bool success = true;
@ -994,10 +994,11 @@ bool cmQtAutoGenerators::Run(const char* targetDirectory,
} }
bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
const char* targetDirectory, const std::string& targetDirectory,
const std::string& config) const std::string& config)
{ {
std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); std::string filename(
cmSystemTools::CollapseFullPath(targetDirectory.c_str()));
cmSystemTools::ConvertToUnixSlashes(filename); cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutogenInfo.cmake"; filename += "/AutogenInfo.cmake";
@ -1137,9 +1138,10 @@ std::string cmQtAutoGenerators::MakeCompileSettingsString(cmMakefile* makefile)
bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(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); cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutomocOldMocDefinitions.cmake"; filename += "/AutomocOldMocDefinitions.cmake";
@ -1153,9 +1155,11 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile,
void 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); cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutomocOldMocDefinitions.cmake"; filename += "/AutomocOldMocDefinitions.cmake";

View File

@ -21,7 +21,7 @@ class cmQtAutoGenerators
{ {
public: public:
cmQtAutoGenerators(); cmQtAutoGenerators();
bool Run(const char* targetDirectory, const std::string& config); bool Run(const std::string& targetDirectory, const std::string& config);
bool InitializeAutogenTarget(cmTarget* target); bool InitializeAutogenTarget(cmTarget* target);
void SetupAutoGenerateTarget(cmTarget const* target); void SetupAutoGenerateTarget(cmTarget const* target);
@ -37,11 +37,11 @@ private:
void SetupAutoRccTarget(cmTarget const* target); void SetupAutoRccTarget(cmTarget const* target);
bool ReadAutogenInfoFile(cmMakefile* makefile, bool ReadAutogenInfoFile(cmMakefile* makefile,
const char* targetDirectory, const std::string& targetDirectory,
const std::string& config); const std::string& config);
bool ReadOldMocDefinitionsFile(cmMakefile* makefile, bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
const char* targetDirectory); const std::string& targetDirectory);
void WriteOldMocDefinitionsFile(const char* targetDirectory); void WriteOldMocDefinitionsFile(const std::string& targetDirectory);
std::string MakeCompileSettingsString(cmMakefile* makefile); std::string MakeCompileSettingsString(cmMakefile* makefile);

View File

@ -2667,7 +2667,7 @@ int cmake::Build(const std::string& dir,
return 1; return 1;
} }
projName = it.GetValue(); projName = it.GetValue();
return gen->Build(0, dir.c_str(), return gen->Build("", dir.c_str(),
projName.c_str(), target.c_str(), projName.c_str(), target.c_str(),
&output, &output,
0, 0,