From 24b5e93de2c753e94cae3b41c1ca7cddaa03e5e7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 17:38:30 -0500 Subject: stringapi: Use strings for directories --- Source/cmGlobalGenerator.cxx | 9 +++++---- Source/cmGlobalGenerator.h | 6 +++--- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 2 +- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmMakefile.cxx | 9 +++++---- Source/cmMakefile.h | 2 +- Source/cmQtAutoGenerators.cxx | 20 ++++++++++++-------- Source/cmQtAutoGenerators.h | 8 ++++---- Source/cmake.cxx | 2 +- 19 files changed, 44 insertions(+), 38 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a14696d..c1cce2e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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& 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 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: "; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 5b97960..761fb07 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -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& 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 const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 16e9788..73a6245 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -553,7 +553,7 @@ void cmGlobalNinjaGenerator ::GenerateBuildCommand(std::vector& 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*/, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 86c2912..4a28486 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -195,7 +195,7 @@ public: std::vector& 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, diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index d947150..9ddbe5b 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -567,7 +567,7 @@ void cmGlobalUnixMakefileGenerator3 ::GenerateBuildCommand(std::vector& 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, diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 8924fa8..d64afaf 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -111,7 +111,7 @@ public: std::vector& 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, diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 0bc572b..3819a5b 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -312,7 +312,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( std::vector& 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 += "/"; diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 085f2d2..5d902ee 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -36,7 +36,7 @@ public: std::vector& 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, diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 82047d7..3a51fce 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -118,7 +118,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( std::vector& 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*/, diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index f7ef972..eb3dddf 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -56,7 +56,7 @@ public: std::vector& 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, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index c65bdaa..3927100 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -185,7 +185,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( std::vector& 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*/, diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 342fa88..b659480 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -64,7 +64,7 @@ public: std::vector& 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, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ec2e1e9..e1f2a91 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -262,7 +262,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( std::vector& 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*/, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index e9149c2..aec7958 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -57,7 +57,7 @@ public: std::vector& 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, diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bb88bc4..e61b12b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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 diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7c82ec2..fb40c1b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -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 *cmakeArgs, diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 8eee991..48a6b38 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -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"; diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index af4ceb9..a593dd5 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -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); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5ada30e..13572f4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -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, -- cgit v0.12