summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackGenerator.cxx14
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx12
-rw-r--r--Source/CPack/cpack.cxx2
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx6
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx2
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx2
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx20
-rw-r--r--Source/CTest/cmCTestGIT.cxx12
-rw-r--r--Source/CTest/cmCTestLaunch.cxx10
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx24
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx8
-rw-r--r--Source/CTest/cmCTestRunTest.cxx4
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx20
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx12
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx12
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx14
-rw-r--r--Source/CTest/cmCTestUploadCommand.cxx2
-rw-r--r--Source/CTest/cmCTestVC.cxx2
-rw-r--r--Source/CTest/cmParseCoberturaCoverage.cxx2
-rw-r--r--Source/cmAddCompileOptionsCommand.cxx2
-rw-r--r--Source/cmAddCustomCommandCommand.cxx4
-rw-r--r--Source/cmAddCustomTargetCommand.cxx2
-rw-r--r--Source/cmAddDefinitionsCommand.cxx2
-rw-r--r--Source/cmAddExecutableCommand.cxx2
-rw-r--r--Source/cmAddLibraryCommand.cxx2
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx4
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx2
-rw-r--r--Source/cmCPluginAPI.cxx4
-rw-r--r--Source/cmCTest.cxx38
-rw-r--r--Source/cmCacheManager.cxx6
-rw-r--r--Source/cmComputeLinkInformation.cxx11
-rw-r--r--Source/cmConditionEvaluator.cxx2
-rw-r--r--Source/cmConfigureFileCommand.cxx2
-rw-r--r--Source/cmCoreTryCompile.cxx20
-rw-r--r--Source/cmCoreTryCompile.h2
-rw-r--r--Source/cmCustomCommandGenerator.cxx2
-rw-r--r--Source/cmDependsC.cxx23
-rw-r--r--Source/cmDependsFortran.cxx20
-rw-r--r--Source/cmExecProgramCommand.cxx4
-rw-r--r--Source/cmExecuteProcessCommand.cxx2
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx3
-rw-r--r--Source/cmExportCommand.cxx8
-rw-r--r--Source/cmExportFileGenerator.cxx22
-rw-r--r--Source/cmExportInstallFileGenerator.cxx14
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx14
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx19
-rw-r--r--Source/cmExtraKateGenerator.cxx16
-rw-r--r--Source/cmExtraKateGenerator.h3
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx3
-rw-r--r--Source/cmFileCommand.cxx44
-rw-r--r--Source/cmFindLibraryCommand.cxx2
-rw-r--r--Source/cmFindPackageCommand.cxx13
-rw-r--r--Source/cmFindPathCommand.cxx4
-rw-r--r--Source/cmFortranParserImpl.cxx6
-rw-r--r--Source/cmGeneratedFileStream.cxx2
-rw-r--r--Source/cmGeneratorExpression.cxx2
-rw-r--r--Source/cmGeneratorExpressionNode.cxx3
-rw-r--r--Source/cmGeneratorTarget.cxx10
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx2
-rw-r--r--Source/cmGetPropertyCommand.cxx2
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx20
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx4
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx4
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx7
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx3
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Source/cmIncludeCommand.cxx4
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx2
-rw-r--r--Source/cmInstallCommand.cxx8
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx2
-rw-r--r--Source/cmInstallExportGenerator.cxx2
-rw-r--r--Source/cmInstallFilesCommand.cxx4
-rw-r--r--Source/cmInstallGenerator.cxx4
-rw-r--r--Source/cmInstallProgramsCommand.cxx4
-rw-r--r--Source/cmLinkDirectoriesCommand.cxx2
-rw-r--r--Source/cmLoadCacheCommand.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx28
-rw-r--r--Source/cmLocalGenerator.h4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx19
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h3
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx3
-rw-r--r--Source/cmMakeDirectoryCommand.cxx4
-rw-r--r--Source/cmMakefile.cxx30
-rw-r--r--Source/cmMakefile.h19
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx10
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx10
-rw-r--r--Source/cmMakefileTargetGenerator.cxx28
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx8
-rw-r--r--Source/cmNinjaTargetGenerator.cxx8
-rw-r--r--Source/cmOSXBundleGenerator.cxx10
-rw-r--r--Source/cmOrderDirectories.cxx2
-rw-r--r--Source/cmOutputConverter.cxx4
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx22
-rw-r--r--Source/cmQTWrapCPPCommand.cxx2
-rw-r--r--Source/cmQTWrapUICommand.cxx2
-rw-r--r--Source/cmQtAutoGenInitializer.cxx6
-rw-r--r--Source/cmRemoveDefinitionsCommand.cxx2
-rw-r--r--Source/cmServerProtocol.cxx11
-rw-r--r--Source/cmSetPropertyCommand.cxx2
-rw-r--r--Source/cmSourceFile.cxx2
-rw-r--r--Source/cmSourceFileLocation.cxx6
-rw-r--r--Source/cmSourceGroupCommand.cxx4
-rw-r--r--Source/cmState.cxx10
-rw-r--r--Source/cmState.h4
-rw-r--r--Source/cmSystemTools.cxx25
-rw-r--r--Source/cmSystemTools.h5
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx2
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.cxx4
-rw-r--r--Source/cmTryCompileCommand.cxx2
-rw-r--r--Source/cmTryRunCommand.cxx2
-rw-r--r--Source/cmUseMangledMesaCommand.cxx2
-rw-r--r--Source/cmUtilitySourceCommand.cxx4
-rw-r--r--Source/cmWriteFileCommand.cxx4
-rw-r--r--Source/cmake.cxx37
-rw-r--r--Source/cmake.h4
-rw-r--r--Source/cmcmd.cxx11
120 files changed, 470 insertions, 506 deletions
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 893b2fc..9ff547a 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -239,8 +239,7 @@ int cmCPackArchiveGenerator::PackageFiles()
cmWorkingDirectory workdir(toplevel);
for (std::string const& file : files) {
// Get the relative path to the file
- std::string rp =
- cmSystemTools::RelativePath(toplevel.c_str(), file.c_str());
+ std::string rp = cmSystemTools::RelativePath(toplevel, file);
archive.Add(rp, 0, nullptr, false);
if (!archive) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem while adding file< "
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 54a2a27..d838b30 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -187,7 +187,7 @@ int cmCPackGenerator::InstallProject()
const char* tempInstallDirectory = tempInstallDirectoryStr.c_str();
int res = 1;
- if (!cmsys::SystemTools::MakeDirectory(bareTempInstallDirectory.c_str())) {
+ if (!cmsys::SystemTools::MakeDirectory(bareTempInstallDirectory)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating temporary directory: "
<< (tempInstallDirectory ? tempInstallDirectory : "(NULL)")
@@ -374,15 +374,14 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
continue;
}
std::string filePath = tempDir;
- filePath += "/" + subdir + "/" +
- cmSystemTools::RelativePath(top.c_str(), gf.c_str());
+ filePath += "/" + subdir + "/" + cmSystemTools::RelativePath(top, gf);
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: "
<< inFile << " -> " << filePath << std::endl);
/* If the file is a symlink we will have to re-create it */
if (cmSystemTools::FileIsSymlink(inFile)) {
std::string targetFile;
std::string inFileRelative =
- cmSystemTools::RelativePath(top.c_str(), inFile.c_str());
+ cmSystemTools::RelativePath(top, inFile);
cmSystemTools::ReadSymlink(inFile, targetFile);
symlinkedFiles.emplace_back(std::move(targetFile),
std::move(inFileRelative));
@@ -772,9 +771,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
// Remember the list of files before installation
// of the current component (if we are in component install)
- const char* InstallPrefix = tempInstallDirectory.c_str();
+ std::string const& InstallPrefix = tempInstallDirectory;
std::vector<std::string> filesBefore;
- std::string findExpr(InstallPrefix);
+ std::string findExpr = tempInstallDirectory;
if (componentInstall) {
cmsys::Glob glB;
findExpr += "/*";
@@ -829,8 +828,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
std::string localFileName;
// Populate the File field of each component
for (fit = result.begin(); fit != diff; ++fit) {
- localFileName =
- cmSystemTools::RelativePath(InstallPrefix, fit->c_str());
+ localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit);
localFileName =
localFileName.substr(localFileName.find_first_not_of('/'));
Components[installComponent].Files.push_back(localFileName);
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index ef2add3..3f7164a 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -62,8 +62,7 @@ int cmCPackNSISGenerator::PackageFiles()
std::ostringstream str;
for (std::string const& file : files) {
std::string outputDir = "$INSTDIR";
- std::string fileN =
- cmSystemTools::RelativePath(toplevel.c_str(), file.c_str());
+ std::string fileN = cmSystemTools::RelativePath(toplevel, file);
if (!this->Components.empty()) {
const std::string::size_type pos = fileN.find('/');
@@ -90,8 +89,7 @@ int cmCPackNSISGenerator::PackageFiles()
std::ostringstream dstr;
for (std::string const& dir : dirs) {
std::string componentName;
- std::string fileN =
- cmSystemTools::RelativePath(toplevel.c_str(), dir.c_str());
+ std::string fileN = cmSystemTools::RelativePath(toplevel, dir);
if (fileN.empty()) {
continue;
}
@@ -669,8 +667,8 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
uploadDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
uploadDirectory += "/CPackUploads";
}
- if (!cmSystemTools::FileExists(uploadDirectory.c_str())) {
- if (!cmSystemTools::MakeDirectory(uploadDirectory.c_str())) {
+ if (!cmSystemTools::FileExists(uploadDirectory)) {
+ if (!cmSystemTools::MakeDirectory(uploadDirectory)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Unable to create NSIS upload directory "
<< uploadDirectory << std::endl);
@@ -683,7 +681,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Building downloaded component archive: " << archiveFile
<< std::endl);
- if (cmSystemTools::FileExists(archiveFile.c_str(), true)) {
+ if (cmSystemTools::FileExists(archiveFile, true)) {
if (!cmSystemTools::RemoveFile(archiveFile)) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Unable to remove archive file "
<< archiveFile << std::endl);
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 7d47798..507a10c 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -260,7 +260,7 @@ int main(int argc, char const* const* argv)
globalMF.AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str());
}
- if (cmSystemTools::FileExists(cpackConfigFile.c_str())) {
+ if (cmSystemTools::FileExists(cpackConfigFile)) {
cpackConfigFile = cmSystemTools::CollapseFullPath(cpackConfigFile);
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Read CPack configuration file: " << cpackConfigFile
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 5ccab26..2e1ea4c 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -193,7 +193,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
out << "Internal cmake changing into directory: " << this->BinaryDir
<< std::endl;
if (!cmSystemTools::FileIsDirectory(this->BinaryDir)) {
- cmSystemTools::MakeDirectory(this->BinaryDir.c_str());
+ cmSystemTools::MakeDirectory(this->BinaryDir);
}
cmWorkingDirectory workdir(this->BinaryDir);
@@ -280,7 +280,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
cmCTestTestHandler::FindExecutable(this->CTest, this->TestCommand.c_str(),
resultingConfig, extraPaths, failed);
- if (!cmSystemTools::FileExists(fullPath.c_str())) {
+ if (!cmSystemTools::FileExists(fullPath)) {
out << "Could not find path to executable, perhaps it was not built: "
<< this->TestCommand << "\n";
out << "tried to find it in these places:\n";
@@ -358,7 +358,7 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
idx++;
this->BinaryDir = allArgs[idx];
// dir must exist before CollapseFullPath is called
- cmSystemTools::MakeDirectory(this->BinaryDir.c_str());
+ cmSystemTools::MakeDirectory(this->BinaryDir);
this->BinaryDir = cmSystemTools::CollapseFullPath(this->BinaryDir);
this->SourceDir = cmSystemTools::CollapseFullPath(this->SourceDir);
} else {
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index ad28d92..ce6fbc7 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -709,7 +709,7 @@ cmCTestBuildHandler::LaunchHelper::LaunchHelper(cmCTestBuildHandler* handler)
if (this->Handler->UseCTestLaunch) {
// Enable launcher fragments.
- cmSystemTools::MakeDirectory(launchDir.c_str());
+ cmSystemTools::MakeDirectory(launchDir);
this->WriteLauncherConfig();
std::string launchEnv = "CTEST_LAUNCH_LOGS=";
launchEnv += launchDir;
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index c44b866..7b5c3bc 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -57,7 +57,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
}
const std::string cmakelists_file = source_dir + "/CMakeLists.txt";
- if (!cmSystemTools::FileExists(cmakelists_file.c_str())) {
+ if (!cmSystemTools::FileExists(cmakelists_file)) {
std::ostringstream e;
e << "CMakeLists.txt file does not exist [" << cmakelists_file << "]";
this->SetError(e.str());
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 856421f..9c66e73 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -240,7 +240,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(std::string const& file,
// If it is the same as fileDir, then ignore, otherwise check.
std::string relPath;
if (!checkDir.empty()) {
- relPath = cmSystemTools::RelativePath(checkDir.c_str(), fFile.c_str());
+ relPath = cmSystemTools::RelativePath(checkDir, fFile);
} else {
relPath = fFile;
}
@@ -450,7 +450,7 @@ int cmCTestCoverageHandler::ProcessHandler()
"Process file: " << fullFileName << std::endl,
this->Quiet);
- if (!cmSystemTools::FileExists(fullFileName.c_str())) {
+ if (!cmSystemTools::FileExists(fullFileName)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find file: " << fullFileName << std::endl);
continue;
@@ -718,7 +718,7 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage(
// build the find file string with the directory from above
coverageXMLFile += "/coverage.xml";
- if (cmSystemTools::FileExists(coverageXMLFile.c_str())) {
+ if (cmSystemTools::FileExists(coverageXMLFile)) {
// If file exists, parse it
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Parsing Cobertura XML file: " << coverageXMLFile
@@ -741,7 +741,7 @@ int cmCTestCoverageHandler::HandleMumpsCoverage(
cmParseGTMCoverage cov(*cont, this->CTest);
std::string coverageFile =
this->CTest->GetBinaryDir() + "/gtm_coverage.mcov";
- if (cmSystemTools::FileExists(coverageFile.c_str())) {
+ if (cmSystemTools::FileExists(coverageFile)) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Parsing Cache Coverage: " << coverageFile << std::endl,
this->Quiet);
@@ -754,7 +754,7 @@ int cmCTestCoverageHandler::HandleMumpsCoverage(
this->Quiet);
cmParseCacheCoverage ccov(*cont, this->CTest);
coverageFile = this->CTest->GetBinaryDir() + "/cache_coverage.cmcov";
- if (cmSystemTools::FileExists(coverageFile.c_str())) {
+ if (cmSystemTools::FileExists(coverageFile)) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Parsing Cache Coverage: " << coverageFile << std::endl,
this->Quiet);
@@ -975,7 +975,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
std::string testingDir = this->CTest->GetBinaryDir() + "/Testing";
std::string tempDir = testingDir + "/CoverageInfo";
- cmSystemTools::MakeDirectory(tempDir.c_str());
+ cmSystemTools::MakeDirectory(tempDir);
cmWorkingDirectory workdir(tempDir);
int gcovStyle = 0;
@@ -1646,7 +1646,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
std::string testingDir = this->CTest->GetBinaryDir() + "/Testing";
std::string tempDir = testingDir + "/CoverageInfo";
- cmSystemTools::MakeDirectory(tempDir.c_str());
+ cmSystemTools::MakeDirectory(tempDir);
int file_count = 0;
for (std::string const& file : files) {
@@ -1742,11 +1742,11 @@ std::string cmCTestCoverageHandler::FindFile(
cmSystemTools::GetFilenameWithoutLastExtension(fileName);
// First check in source and binary directory
std::string fullName = cont->SourceDir + "/" + fileNameNoE + ".py";
- if (cmSystemTools::FileExists(fullName.c_str())) {
+ if (cmSystemTools::FileExists(fullName)) {
return fullName;
}
fullName = cont->BinaryDir + "/" + fileNameNoE + ".py";
- if (cmSystemTools::FileExists(fullName.c_str())) {
+ if (cmSystemTools::FileExists(fullName)) {
return fullName;
}
return "";
@@ -2012,7 +2012,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
}
std::string file = sourceFile;
coveredFileNames.insert(file);
- if (!cmSystemTools::FileIsFullPath(sourceFile.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(sourceFile)) {
// file will be relative to the binary dir
file = cont->BinaryDir;
file += "/";
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 8cb795e..e85af5e 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -113,7 +113,7 @@ std::string cmCTestGIT::FindGitDir()
// are a Windows application. Run "cygpath" to get Windows path.
std::string cygpath_exe = cmSystemTools::GetFilenamePath(git);
cygpath_exe += "/cygpath.exe";
- if (cmSystemTools::FileExists(cygpath_exe.c_str())) {
+ if (cmSystemTools::FileExists(cygpath_exe)) {
char const* cygpath[] = { cygpath_exe.c_str(), "-w", git_dir.c_str(),
0 };
OneLineParser cygpath_out(this, "cygpath-out> ", git_dir_line);
@@ -249,7 +249,7 @@ bool cmCTestGIT::UpdateImpl()
if (this->GetGitVersion() < cmCTestGITVersion(1, 6, 5, 0)) {
recursive = nullptr;
// No need to require >= 1.6.5 if there are no submodules.
- if (cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) {
+ if (cmSystemTools::FileExists(top_dir + "/.gitmodules")) {
this->Log << "Git < 1.6.5 cannot update submodules recursively\n";
}
}
@@ -258,7 +258,7 @@ bool cmCTestGIT::UpdateImpl()
if (this->GetGitVersion() < cmCTestGITVersion(1, 8, 1, 0)) {
sync_recursive = nullptr;
// No need to require >= 1.8.1 if there are no submodules.
- if (cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) {
+ if (cmSystemTools::FileExists(top_dir + "/.gitmodules")) {
this->Log << "Git < 1.8.1 cannot synchronize submodules recursively\n";
}
}
@@ -553,15 +553,15 @@ private:
void DoHeaderLine()
{
// Look for header fields that we need.
- if (cmHasLiteralPrefix(this->Line.c_str(), "commit ")) {
+ if (cmHasLiteralPrefix(this->Line, "commit ")) {
this->Rev.Rev = this->Line.c_str() + 7;
- } else if (cmHasLiteralPrefix(this->Line.c_str(), "author ")) {
+ } else if (cmHasLiteralPrefix(this->Line, "author ")) {
Person author;
this->ParsePerson(this->Line.c_str() + 7, author);
this->Rev.Author = author.Name;
this->Rev.EMail = author.EMail;
this->Rev.Date = this->FormatDateTime(author);
- } else if (cmHasLiteralPrefix(this->Line.c_str(), "committer ")) {
+ } else if (cmHasLiteralPrefix(this->Line, "committer ")) {
Person committer;
this->ParsePerson(this->Line.c_str() + 10, committer);
this->Rev.Committer = committer.Name;
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 07dd2f5..30f76a9 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -377,11 +377,10 @@ void cmCTestLaunch::WriteXMLAction(cmXMLWriter& xml)
cmSystemTools::ConvertToUnixSlashes(source);
// If file is in source tree use its relative location.
- if (cmSystemTools::FileIsFullPath(this->SourceDir.c_str()) &&
- cmSystemTools::FileIsFullPath(source.c_str()) &&
+ if (cmSystemTools::FileIsFullPath(this->SourceDir) &&
+ cmSystemTools::FileIsFullPath(source) &&
cmSystemTools::IsSubDirectory(source, this->SourceDir)) {
- source =
- cmSystemTools::RelativePath(this->SourceDir.c_str(), source.c_str());
+ source = cmSystemTools::RelativePath(this->SourceDir, source);
}
xml.Element("SourceFile", source);
@@ -629,8 +628,7 @@ void cmCTestLaunch::LoadConfig()
cmMakefile mf(&gg, cm.GetCurrentSnapshot());
std::string fname = this->LogDir;
fname += "CTestLaunchConfig.cmake";
- if (cmSystemTools::FileExists(fname.c_str()) &&
- mf.ReadListFile(fname.c_str())) {
+ if (cmSystemTools::FileExists(fname) && mf.ReadListFile(fname.c_str())) {
this->SourceDir = mf.GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
cmSystemTools::ConvertToUnixSlashes(this->SourceDir);
}
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 84151e8..cb1d947 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -163,7 +163,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
std::string index;
std::ostringstream stream;
std::string memcheckcommand =
- cmSystemTools::ConvertToOutputPath(this->MemoryTester.c_str());
+ cmSystemTools::ConvertToOutputPath(this->MemoryTester);
stream << test;
index = stream.str();
for (std::string arg : this->MemoryTesterDynamicOptions) {
@@ -426,7 +426,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTester.clear();
// Setup the command
if (cmSystemTools::FileExists(
- this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str())) {
+ this->CTest->GetCTestConfiguration("MemoryCheckCommand"))) {
this->MemoryTester =
this->CTest->GetCTestConfiguration("MemoryCheckCommand");
std::string testerName =
@@ -443,17 +443,15 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTesterStyle = cmCTestMemCheckHandler::UNKNOWN;
}
} else if (cmSystemTools::FileExists(
- this->CTest->GetCTestConfiguration("PurifyCommand").c_str())) {
+ this->CTest->GetCTestConfiguration("PurifyCommand"))) {
this->MemoryTester = this->CTest->GetCTestConfiguration("PurifyCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
} else if (cmSystemTools::FileExists(
- this->CTest->GetCTestConfiguration("ValgrindCommand")
- .c_str())) {
+ this->CTest->GetCTestConfiguration("ValgrindCommand"))) {
this->MemoryTester = this->CTest->GetCTestConfiguration("ValgrindCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
} else if (cmSystemTools::FileExists(
- this->CTest->GetCTestConfiguration("BoundsCheckerCommand")
- .c_str())) {
+ this->CTest->GetCTestConfiguration("BoundsCheckerCommand"))) {
this->MemoryTester =
this->CTest->GetCTestConfiguration("BoundsCheckerCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
@@ -537,9 +535,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
}
if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
.empty()) {
- if (!cmSystemTools::FileExists(
- this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
- .c_str())) {
+ if (!cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
+ "MemoryCheckSuppressionFile"))) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find memory checker suppression file: "
<< this->CTest->GetCTestConfiguration(
@@ -560,9 +557,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
#ifdef _WIN32
if (this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
.size()) {
- if (!cmSystemTools::FileExists(
- this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
- .c_str())) {
+ if (!cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
+ "MemoryCheckSuppressionFile"))) {
cmCTestLog(
this->CTest, ERROR_MESSAGE,
"Cannot find memory checker suppression file: "
@@ -1093,7 +1089,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(
files = g.GetFiles();
return;
}
- } else if (!cmSystemTools::FileExists(ofile.c_str())) {
+ } else if (!cmSystemTools::FileExists(ofile)) {
std::string log = "Cannot find memory tester output file: " + ofile;
cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
ofile.clear();
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index eee9b6c..50c2d86 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -413,7 +413,7 @@ void cmCTestMultiProcessHandler::UpdateCostData()
PropertiesMap temp = this->Properties;
- if (cmSystemTools::FileExists(fname.c_str())) {
+ if (cmSystemTools::FileExists(fname)) {
cmsys::ifstream fin;
fin.open(fname.c_str());
@@ -466,7 +466,7 @@ void cmCTestMultiProcessHandler::ReadCostData()
{
std::string fname = this->CTest->GetCostDataFile();
- if (cmSystemTools::FileExists(fname.c_str(), true)) {
+ if (cmSystemTools::FileExists(fname, true)) {
cmsys::ifstream fin;
fin.open(fname.c_str());
std::string line;
@@ -741,7 +741,7 @@ void cmCTestMultiProcessHandler::CheckResume()
std::string fname =
this->CTest->GetBinaryDir() + "/Testing/Temporary/CTestCheckpoint.txt";
if (this->CTest->GetFailover()) {
- if (cmSystemTools::FileExists(fname.c_str(), true)) {
+ if (cmSystemTools::FileExists(fname, true)) {
*this->TestHandler->LogFile
<< "Resuming previously interrupted test set" << std::endl
<< "----------------------------------------------------------"
@@ -756,7 +756,7 @@ void cmCTestMultiProcessHandler::CheckResume()
}
fin.close();
}
- } else if (cmSystemTools::FileExists(fname.c_str(), true)) {
+ } else if (cmSystemTools::FileExists(fname, true)) {
cmSystemTools::RemoveFile(fname);
}
}
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 8d602fa..30ad38c 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -467,7 +467,7 @@ bool cmCTestRunTest::StartTest(size_t total)
// Check if all required files exist
for (std::string const& file : this->TestProperties->RequiredFiles) {
- if (!cmSystemTools::FileExists(file.c_str())) {
+ if (!cmSystemTools::FileExists(file)) {
// Required file was not found
this->TestProcess = cm::make_unique<cmProcess>(*this);
*this->TestHandler->LogFile << "Unable to find required file: " << file
@@ -537,7 +537,7 @@ void cmCTestRunTest::ComputeArguments()
++j; // skip the executable (it will be actualCommand)
}
std::string testCommand =
- cmSystemTools::ConvertToOutputPath(this->ActualCommand.c_str());
+ cmSystemTools::ConvertToOutputPath(this->ActualCommand);
// Prepends memcheck args to our command string
this->TestHandler->GenerateTestCommand(this->Arguments, this->Index);
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 759b695..e0bffd4 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -327,7 +327,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
script_arg = total_script_arg.substr(comma_pos + 1);
}
// make sure the file exists
- if (!cmSystemTools::FileExists(script.c_str())) {
+ if (!cmSystemTools::FileExists(script)) {
cmSystemTools::Error("Cannot find file: ", script.c_str());
return 1;
}
@@ -598,7 +598,7 @@ int cmCTestScriptHandler::CheckOutSourceDir()
int retVal;
bool res;
- if (!cmSystemTools::FileExists(this->SourceDir.c_str()) &&
+ if (!cmSystemTools::FileExists(this->SourceDir) &&
!this->CVSCheckOut.empty()) {
// we must now checkout the src dir
output.clear();
@@ -630,10 +630,10 @@ int cmCTestScriptHandler::BackupDirectories()
// backup the binary and src directories if requested
if (this->Backup) {
// if for some reason those directories exist then first delete them
- if (cmSystemTools::FileExists(this->BackupSourceDir.c_str())) {
+ if (cmSystemTools::FileExists(this->BackupSourceDir)) {
cmSystemTools::RemoveADirectory(this->BackupSourceDir);
}
- if (cmSystemTools::FileExists(this->BackupBinaryDir.c_str())) {
+ if (cmSystemTools::FileExists(this->BackupBinaryDir)) {
cmSystemTools::RemoveADirectory(this->BackupBinaryDir);
}
@@ -716,9 +716,9 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
}
// make sure the binary directory exists if it isn't the srcdir
- if (!cmSystemTools::FileExists(this->BinaryDir.c_str()) &&
+ if (!cmSystemTools::FileExists(this->BinaryDir) &&
this->SourceDir != this->BinaryDir) {
- if (!cmSystemTools::MakeDirectory(this->BinaryDir.c_str())) {
+ if (!cmSystemTools::MakeDirectory(this->BinaryDir)) {
cmSystemTools::Error("Unable to create the binary directory:\n",
this->BinaryDir.c_str());
this->RestoreBackupDirectories();
@@ -782,7 +782,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
if (!this->CMOutFile.empty()) {
std::string cmakeOutputFile = this->CMOutFile;
- if (!cmSystemTools::FileIsFullPath(cmakeOutputFile.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(cmakeOutputFile)) {
cmakeOutputFile = this->BinaryDir + "/" + cmakeOutputFile;
}
@@ -876,10 +876,10 @@ void cmCTestScriptHandler::RestoreBackupDirectories()
// the backed up dirs
if (this->Backup) {
// if for some reason those directories exist then first delete them
- if (cmSystemTools::FileExists(this->SourceDir.c_str())) {
+ if (cmSystemTools::FileExists(this->SourceDir)) {
cmSystemTools::RemoveADirectory(this->SourceDir);
}
- if (cmSystemTools::FileExists(this->BinaryDir.c_str())) {
+ if (cmSystemTools::FileExists(this->BinaryDir)) {
cmSystemTools::RemoveADirectory(this->BinaryDir);
}
// rename the src and binary directories
@@ -918,7 +918,7 @@ bool cmCTestScriptHandler::EmptyBinaryDirectory(const char* sname)
std::string check = sname;
check += "/CMakeCache.txt";
- if (!cmSystemTools::FileExists(check.c_str())) {
+ if (!cmSystemTools::FileExists(check)) {
return false;
}
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 1794ca6..34adb4a 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -229,7 +229,7 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
}
if (this->ArgumentDoing == ArgumentDoingFiles) {
- if (cmSystemTools::FileExists(arg.c_str())) {
+ if (cmSystemTools::FileExists(arg)) {
this->Files.insert(arg);
} else {
std::ostringstream e;
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 1ce2b6f..08d05c8 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -194,13 +194,13 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
std::string local_file = file;
- if (!cmSystemTools::FileExists(local_file.c_str())) {
+ if (!cmSystemTools::FileExists(local_file)) {
local_file = localprefix + "/" + file;
}
std::string upload_as =
url + "/" + remoteprefix + cmSystemTools::GetFilenameName(file);
- if (!cmSystemTools::FileExists(local_file.c_str())) {
+ if (!cmSystemTools::FileExists(local_file)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Cannot find file: " << local_file << std::endl);
::curl_easy_cleanup(curl);
@@ -387,7 +387,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
std::string local_file = file;
- if (!cmSystemTools::FileExists(local_file.c_str())) {
+ if (!cmSystemTools::FileExists(local_file)) {
local_file = localprefix + "/" + file;
}
std::string remote_file =
@@ -429,7 +429,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
cmSystemTools::ComputeFileHash(local_file, cmCryptoHash::AlgoMD5);
}
- if (!cmSystemTools::FileExists(local_file.c_str())) {
+ if (!cmSystemTools::FileExists(local_file)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Cannot find file: " << local_file << std::endl);
::curl_easy_cleanup(curl);
@@ -772,7 +772,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command,
std::string lfname = localprefix;
cmSystemTools::ConvertToUnixSlashes(lfname);
lfname += "/" + file;
- lfname = cmSystemTools::ConvertToOutputPath(lfname.c_str());
+ lfname = cmSystemTools::ConvertToOutputPath(lfname);
argv[1] = lfname.c_str();
std::string rfname = url + "/" + remoteprefix + file;
argv[2] = rfname.c_str();
@@ -898,7 +898,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
xmlrpc_value* result;
std::string local_file = file;
- if (!cmSystemTools::FileExists(local_file.c_str())) {
+ if (!cmSystemTools::FileExists(local_file)) {
local_file = localprefix + "/" + file;
}
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 7bbf8dc..84d8926 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -70,7 +70,7 @@ bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args,
for (std::string const& arg : args) {
std::string fname;
- if (cmSystemTools::FileIsFullPath(arg.c_str())) {
+ if (cmSystemTools::FileIsFullPath(arg)) {
fname = arg;
} else {
fname = cwd;
@@ -145,7 +145,7 @@ bool cmCTestAddSubdirectoryCommand::InitialPass(
fname += "/";
fname += args[0];
- if (!cmSystemTools::FileExists(fname.c_str())) {
+ if (!cmSystemTools::FileExists(fname)) {
// No subdirectory? So what...
return true;
}
@@ -1576,7 +1576,7 @@ std::string cmCTestTestHandler::FindExecutable(
// now look in the paths we specified above
for (unsigned int ai = 0; ai < attempted.size() && fullPath.empty(); ++ai) {
// first check without exe extension
- if (cmSystemTools::FileExists(attempted[ai].c_str()) &&
+ if (cmSystemTools::FileExists(attempted[ai]) &&
!cmSystemTools::FileIsDirectory(attempted[ai])) {
fullPath = cmSystemTools::CollapseFullPath(attempted[ai]);
resultingConfig = attemptedConfigs[ai];
@@ -1586,7 +1586,7 @@ std::string cmCTestTestHandler::FindExecutable(
failed.push_back(attempted[ai]);
tempPath = attempted[ai];
tempPath += cmSystemTools::GetExecutableExtension();
- if (cmSystemTools::FileExists(tempPath.c_str()) &&
+ if (cmSystemTools::FileExists(tempPath) &&
!cmSystemTools::FileIsDirectory(tempPath)) {
fullPath = cmSystemTools::CollapseFullPath(tempPath);
resultingConfig = attemptedConfigs[ai];
@@ -1822,7 +1822,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
std::string lastTestsFailedLog =
this->CTest->GetBinaryDir() + "/Testing/Temporary/" + logName;
- if (!cmSystemTools::FileExists(lastTestsFailedLog.c_str())) {
+ if (!cmSystemTools::FileExists(lastTestsFailedLog)) {
if (!this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels()) {
cmCTestLog(this->CTest, ERROR_MESSAGE, lastTestsFailedLog
<< " does not exist!" << std::endl);
@@ -1935,7 +1935,7 @@ void cmCTestTestHandler::GenerateRegressionImages(cmXMLWriter& xml,
} else if (measurementfile.find(cxml)) {
const std::string& filename =
cmCTest::CleanString(measurementfile.match(5));
- if (cmSystemTools::FileExists(filename.c_str())) {
+ if (cmSystemTools::FileExists(filename)) {
long len = cmSystemTools::FileLength(filename);
if (len == 0) {
std::string k1 = measurementfile.match(1);
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 809abd1..504b210 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -257,37 +257,37 @@ int cmCTestUpdateHandler::DetectVCS(const char* dir)
"Check directory: " << sourceDirectory << std::endl,
this->Quiet);
sourceDirectory += "/.svn";
- if (cmSystemTools::FileExists(sourceDirectory.c_str())) {
+ if (cmSystemTools::FileExists(sourceDirectory)) {
return cmCTestUpdateHandler::e_SVN;
}
sourceDirectory = dir;
sourceDirectory += "/CVS";
- if (cmSystemTools::FileExists(sourceDirectory.c_str())) {
+ if (cmSystemTools::FileExists(sourceDirectory)) {
return cmCTestUpdateHandler::e_CVS;
}
sourceDirectory = dir;
sourceDirectory += "/.bzr";
- if (cmSystemTools::FileExists(sourceDirectory.c_str())) {
+ if (cmSystemTools::FileExists(sourceDirectory)) {
return cmCTestUpdateHandler::e_BZR;
}
sourceDirectory = dir;
sourceDirectory += "/.git";
- if (cmSystemTools::FileExists(sourceDirectory.c_str())) {
+ if (cmSystemTools::FileExists(sourceDirectory)) {
return cmCTestUpdateHandler::e_GIT;
}
sourceDirectory = dir;
sourceDirectory += "/.hg";
- if (cmSystemTools::FileExists(sourceDirectory.c_str())) {
+ if (cmSystemTools::FileExists(sourceDirectory)) {
return cmCTestUpdateHandler::e_HG;
}
sourceDirectory = dir;
sourceDirectory += "/.p4";
- if (cmSystemTools::FileExists(sourceDirectory.c_str())) {
+ if (cmSystemTools::FileExists(sourceDirectory)) {
return cmCTestUpdateHandler::e_P4;
}
sourceDirectory = dir;
sourceDirectory += "/.p4config";
- if (cmSystemTools::FileExists(sourceDirectory.c_str())) {
+ if (cmSystemTools::FileExists(sourceDirectory)) {
return cmCTestUpdateHandler::e_P4;
}
return cmCTestUpdateHandler::e_UNKNOWN;
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
index d85f35f..ec78c1e 100644
--- a/Source/CTest/cmCTestUploadCommand.cxx
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -51,7 +51,7 @@ bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg)
return true;
}
if (this->ArgumentDoing == ArgumentDoingFiles) {
- if (cmSystemTools::FileExists(arg.c_str())) {
+ if (cmSystemTools::FileExists(arg)) {
this->Files.insert(arg);
return true;
}
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index fd7f37a..13fa6e1 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -47,7 +47,7 @@ bool cmCTestVC::InitialCheckout(const char* command)
std::string parent = cmSystemTools::GetFilenamePath(this->SourceDirectory);
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" Perform checkout in directory: " << parent << "\n");
- if (!cmSystemTools::MakeDirectory(parent.c_str())) {
+ if (!cmSystemTools::MakeDirectory(parent)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot create directory: " << parent << std::endl);
return false;
diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx
index 61ce7d4..5bb6424 100644
--- a/Source/CTest/cmParseCoberturaCoverage.cxx
+++ b/Source/CTest/cmParseCoberturaCoverage.cxx
@@ -83,7 +83,7 @@ protected:
// binary directories.
for (std::string const& filePath : FilePaths) {
finalpath = filePath + "/" + filename;
- if (cmSystemTools::FileExists(finalpath.c_str())) {
+ if (cmSystemTools::FileExists(finalpath)) {
this->CurFileName = finalpath;
break;
}
diff --git a/Source/cmAddCompileOptionsCommand.cxx b/Source/cmAddCompileOptionsCommand.cxx
index c37fd9a..412fb38 100644
--- a/Source/cmAddCompileOptionsCommand.cxx
+++ b/Source/cmAddCompileOptionsCommand.cxx
@@ -14,7 +14,7 @@ bool cmAddCompileOptionsCommand::InitialPass(
}
for (std::string const& i : args) {
- this->Makefile->AddCompileOption(i.c_str());
+ this->Makefile->AddCompileOption(i);
}
return true;
}
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 6db50fa..1e3faef 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -204,7 +204,7 @@ bool cmAddCustomCommandCommand::InitialPass(
break;
}
- if (cmSystemTools::FileIsFullPath(filename.c_str())) {
+ if (cmSystemTools::FileIsFullPath(filename)) {
filename = cmSystemTools::CollapseFullPath(filename);
}
switch (doing) {
@@ -405,7 +405,7 @@ bool cmAddCustomCommandCommand::CheckOutputs(
for (std::string const& o : outputs) {
// Make sure the file will not be generated into the source
// directory during an out of source build.
- if (!this->Makefile->CanIWriteThisFile(o.c_str())) {
+ if (!this->Makefile->CanIWriteThisFile(o)) {
std::string e = "attempted to have a file \"" + o +
"\" in a source directory as an output of custom command.";
this->SetError(e);
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index cd1a376..4655f58 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -117,7 +117,7 @@ bool cmAddCustomTargetCommand::InitialPass(
break;
case doing_byproducts: {
std::string filename;
- if (!cmSystemTools::FileIsFullPath(copy.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(copy)) {
filename = this->Makefile->GetCurrentBinaryDirectory();
filename += "/";
}
diff --git a/Source/cmAddDefinitionsCommand.cxx b/Source/cmAddDefinitionsCommand.cxx
index 261fb5b..62e57a3 100644
--- a/Source/cmAddDefinitionsCommand.cxx
+++ b/Source/cmAddDefinitionsCommand.cxx
@@ -16,7 +16,7 @@ bool cmAddDefinitionsCommand::InitialPass(std::vector<std::string> const& args,
}
for (std::string const& i : args) {
- this->Makefile->AddDefineFlag(i.c_str());
+ this->Makefile->AddDefineFlag(i);
}
return true;
}
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 2e95032..5685fdf 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -99,7 +99,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
- const char* aliasedName = s->c_str();
+ std::string const& aliasedName = *s;
if (this->Makefile->IsAlias(aliasedName)) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 0fcffdd..1278232 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -198,7 +198,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
- const char* aliasedName = s->c_str();
+ std::string const& aliasedName = *s;
if (this->Makefile->IsAlias(aliasedName)) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << libName << "\" because target \""
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index 1727ca5..f673c72 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -44,7 +44,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
// Compute the full path to the specified source directory.
// Interpret a relative path with respect to the current source directory.
std::string srcPath;
- if (cmSystemTools::FileIsFullPath(srcArg.c_str())) {
+ if (cmSystemTools::FileIsFullPath(srcArg)) {
srcPath = srcArg;
} else {
srcPath = this->Makefile->GetCurrentSourceDirectory();
@@ -94,7 +94,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
} else {
// Use the binary directory specified.
// Interpret a relative path with respect to the current binary directory.
- if (cmSystemTools::FileIsFullPath(binArg.c_str())) {
+ if (cmSystemTools::FileIsFullPath(binArg)) {
binPath = binArg;
} else {
binPath = this->Makefile->GetCurrentBinaryDirectory();
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index f3cf32e..1f9f580 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -26,7 +26,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
std::string sourceListValue;
std::string const& templateDirectory = args[0];
std::string tdir;
- if (!cmSystemTools::FileIsFullPath(templateDirectory.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(templateDirectory)) {
tdir = this->Makefile->GetCurrentSourceDirectory();
tdir += "/";
tdir += templateDirectory;
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 18a1022..1ec76ac 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -108,12 +108,12 @@ const char* CCONV cmGetProjectName(void* arg)
const char* CCONV cmGetHomeDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetHomeDirectory();
+ return mf->GetHomeDirectory().c_str();
}
const char* CCONV cmGetHomeOutputDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetHomeOutputDirectory();
+ return mf->GetHomeOutputDirectory().c_str();
}
const char* CCONV cmGetStartDirectory(void* arg)
{
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 6f90e70..3fccc38 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -184,7 +184,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
::curl_easy_setopt(curl, CURLOPT_POSTFIELDS, fields.c_str());
break;
case cmCTest::HTTP_PUT:
- if (!cmSystemTools::FileExists(putFile.c_str())) {
+ if (!cmSystemTools::FileExists(putFile)) {
response = "Error: File ";
response += putFile + " does not exist.\n";
return -1;
@@ -429,7 +429,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
// Verify "Testing" directory exists:
//
std::string testingDir = this->BinaryDir + "/Testing";
- if (cmSystemTools::FileExists(testingDir.c_str())) {
+ if (cmSystemTools::FileExists(testingDir)) {
if (!cmSystemTools::FileIsDirectory(testingDir)) {
cmCTestLog(this, ERROR_MESSAGE, "File "
<< testingDir
@@ -438,7 +438,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
return 0;
}
} else {
- if (!cmSystemTools::MakeDirectory(testingDir.c_str())) {
+ if (!cmSystemTools::MakeDirectory(testingDir)) {
cmCTestLog(this, ERROR_MESSAGE, "Cannot create directory "
<< testingDir << std::endl);
return 0;
@@ -556,9 +556,9 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
bld_dir_fname += "/CTestConfig.cmake";
cmSystemTools::ConvertToUnixSlashes(bld_dir_fname);
- if (cmSystemTools::FileExists(bld_dir_fname.c_str())) {
+ if (cmSystemTools::FileExists(bld_dir_fname)) {
fname = bld_dir_fname;
- } else if (cmSystemTools::FileExists(src_dir_fname.c_str())) {
+ } else if (cmSystemTools::FileExists(src_dir_fname)) {
fname = src_dir_fname;
}
@@ -619,12 +619,12 @@ bool cmCTest::UpdateCTestConfiguration()
return true;
}
std::string fileName = this->BinaryDir + "/CTestConfiguration.ini";
- if (!cmSystemTools::FileExists(fileName.c_str())) {
+ if (!cmSystemTools::FileExists(fileName)) {
fileName = this->BinaryDir + "/DartConfiguration.tcl";
}
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
"UpdateCTestConfiguration from :" << fileName << "\n");
- if (!cmSystemTools::FileExists(fileName.c_str())) {
+ if (!cmSystemTools::FileExists(fileName)) {
// No need to exit if we are not producing XML
if (this->ProduceXML) {
cmCTestLog(this, ERROR_MESSAGE, "Cannot find file: " << fileName
@@ -741,7 +741,7 @@ bool cmCTest::OpenOutputFile(const std::string& path, const std::string& name,
if (!path.empty()) {
testingDir += "/" + path;
}
- if (cmSystemTools::FileExists(testingDir.c_str())) {
+ if (cmSystemTools::FileExists(testingDir)) {
if (!cmSystemTools::FileIsDirectory(testingDir)) {
cmCTestLog(this, ERROR_MESSAGE, "File "
<< testingDir << " is in the place of the testing directory"
@@ -749,7 +749,7 @@ bool cmCTest::OpenOutputFile(const std::string& path, const std::string& name,
return false;
}
} else {
- if (!cmSystemTools::MakeDirectory(testingDir.c_str())) {
+ if (!cmSystemTools::MakeDirectory(testingDir)) {
cmCTestLog(this, ERROR_MESSAGE, "Cannot create directory " << testingDir
<< std::endl);
return false;
@@ -790,7 +790,7 @@ bool cmCTest::CTestFileExists(const std::string& filename)
{
std::string testingDir =
this->BinaryDir + "/Testing/" + this->CurrentTag + "/" + filename;
- return cmSystemTools::FileExists(testingDir.c_str());
+ return cmSystemTools::FileExists(testingDir);
}
cmCTestGenericHandler* cmCTest::GetInitializedHandler(const char* handler)
@@ -890,7 +890,7 @@ int cmCTest::ProcessSteps()
for (kk = 0; kk < d.GetNumberOfFiles(); kk++) {
const char* file = d.GetFile(kk);
std::string fullname = notes_dir + "/" + file;
- if (cmSystemTools::FileExists(fullname.c_str()) &&
+ if (cmSystemTools::FileExists(fullname) &&
!cmSystemTools::FileIsDirectory(fullname)) {
if (!this->NotesFiles.empty()) {
this->NotesFiles += ";";
@@ -939,10 +939,10 @@ int cmCTest::GetTestModelFromString(const char* str)
return cmCTest::EXPERIMENTAL;
}
std::string rstr = cmSystemTools::LowerCase(str);
- if (cmHasLiteralPrefix(rstr.c_str(), "cont")) {
+ if (cmHasLiteralPrefix(rstr, "cont")) {
return cmCTest::CONTINUOUS;
}
- if (cmHasLiteralPrefix(rstr.c_str(), "nigh")) {
+ if (cmHasLiteralPrefix(rstr, "nigh")) {
return cmCTest::NIGHTLY;
}
return cmCTest::EXPERIMENTAL;
@@ -1523,7 +1523,7 @@ std::string cmCTest::Base64EncodeFile(std::string const& file)
bool cmCTest::SubmitExtraFiles(const VectorOfStrings& files)
{
for (cmsys::String const& file : files) {
- if (!cmSystemTools::FileExists(file.c_str())) {
+ if (!cmSystemTools::FileExists(file)) {
cmCTestLog(this, ERROR_MESSAGE, "Cannot find extra file: "
<< file << " to submit." << std::endl;);
return false;
@@ -2307,7 +2307,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf)
std::string fname = dir;
fname += "/CTestCustom.cmake";
cmCTestLog(this, DEBUG, "* Check for file: " << fname << std::endl);
- if (cmSystemTools::FileExists(fname.c_str())) {
+ if (cmSystemTools::FileExists(fname)) {
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
<< fname << std::endl);
bool erroroc = cmSystemTools::GetErrorOccuredFlag();
@@ -2327,7 +2327,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf)
std::string rexpr = dir;
rexpr += "/CTestCustom.ctest";
cmCTestLog(this, DEBUG, "* Check for file: " << rexpr << std::endl);
- if (!found && cmSystemTools::FileExists(rexpr.c_str())) {
+ if (!found && cmSystemTools::FileExists(rexpr)) {
cmsys::Glob gl;
gl.RecurseOn();
gl.FindFiles(rexpr);
@@ -2394,10 +2394,8 @@ std::string cmCTest::GetShortPathToFile(const char* cfname)
std::string fname = cmSystemTools::CollapseFullPath(cfname);
// Find relative paths to both directories
- std::string srcRelpath =
- cmSystemTools::RelativePath(sourceDir.c_str(), fname.c_str());
- std::string bldRelpath =
- cmSystemTools::RelativePath(buildDir.c_str(), fname.c_str());
+ std::string srcRelpath = cmSystemTools::RelativePath(sourceDir, fname);
+ std::string bldRelpath = cmSystemTools::RelativePath(buildDir, fname);
// If any contains "." it is not parent directory
bool inSrc = srcRelpath.find("..") == std::string::npos;
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 64aa46e..fab2445 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -43,7 +43,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
if (internal) {
this->Cache.clear();
}
- if (!cmSystemTools::FileExists(cacheFile.c_str())) {
+ if (!cmSystemTools::FileExists(cacheFile)) {
this->CleanCMakeFiles(path);
return false;
}
@@ -358,7 +358,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
fout.Close();
std::string checkCacheFile = path;
checkCacheFile += cmake::GetCMakeFilesDirectory();
- cmSystemTools::MakeDirectory(checkCacheFile.c_str());
+ cmSystemTools::MakeDirectory(checkCacheFile);
checkCacheFile += "/cmake.check_cache";
cmsys::ofstream checkCache(checkCacheFile.c_str());
if (!checkCache) {
@@ -377,7 +377,7 @@ bool cmCacheManager::DeleteCache(const std::string& path)
cmSystemTools::ConvertToUnixSlashes(cacheFile);
std::string cmakeFiles = cacheFile;
cacheFile += "/CMakeCache.txt";
- if (cmSystemTools::FileExists(cacheFile.c_str())) {
+ if (cmSystemTools::FileExists(cacheFile)) {
cmSystemTools::RemoveFile(cacheFile);
// now remove the files in the CMakeFiles directory
// this cleans up language cache files
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 33dd2d7..8a5a6de 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -632,7 +632,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
}
} else {
// This is not a CMake target. Use the name given.
- if (cmSystemTools::FileIsFullPath(item.c_str())) {
+ if (cmSystemTools::FileIsFullPath(item)) {
if (cmSystemTools::FileIsDirectory(item)) {
// This is a directory.
this->AddDirectoryItem(item);
@@ -668,13 +668,13 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
} else {
// Skip items that are not full paths. We will not be able to
// reliably specify them.
- if (!cmSystemTools::FileIsFullPath(item.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(item)) {
return;
}
// Get the name of the library from the file name.
std::string file = cmSystemTools::GetFilenameName(item);
- if (!this->ExtractSharedLibraryName.find(file.c_str())) {
+ if (!this->ExtractSharedLibraryName.find(file)) {
// This is not the name of a shared library.
return;
}
@@ -1746,8 +1746,9 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
}
} else if (use_link_rpath) {
// Do not add any path inside the source or build tree.
- const char* topSourceDir = this->CMakeInstance->GetHomeDirectory();
- const char* topBinaryDir =
+ std::string const& topSourceDir =
+ this->CMakeInstance->GetHomeDirectory();
+ std::string const& topBinaryDir =
this->CMakeInstance->GetHomeOutputDirectory();
if (!cmSystemTools::ComparePath(ri, topSourceDir) &&
!cmSystemTools::ComparePath(ri, topBinaryDir) &&
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 90b3f6d..172ef92 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -494,7 +494,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
if (argP1len > 4 && argP1->GetValue().substr(0, 4) == "ENV{" &&
argP1->GetValue().operator[](argP1len - 1) == '}') {
std::string env = argP1->GetValue().substr(4, argP1len - 5);
- bdef = cmSystemTools::HasEnv(env.c_str());
+ bdef = cmSystemTools::HasEnv(env);
} else {
bdef = this->Makefile.IsDefinitionSet(argP1->GetValue());
}
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index 18005f2..b5a639a 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -51,7 +51,7 @@ bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args,
this->OutputFile += cmSystemTools::GetFilenameName(inFile);
}
- if (!this->Makefile->CanIWriteThisFile(this->OutputFile.c_str())) {
+ if (!this->Makefile->CanIWriteThisFile(this->OutputFile)) {
std::string e = "attempted to configure a file: " + this->OutputFile +
" into a source directory.";
this->SetError(e);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 7b28857..34c6175 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -391,7 +391,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
}
}
// make sure the binary directory exists
- cmSystemTools::MakeDirectory(this->BinaryDirectory.c_str());
+ cmSystemTools::MakeDirectory(this->BinaryDirectory);
// do not allow recursive try Compiles
if (this->BinaryDirectory == this->Makefile->GetHomeOutputDirectory()) {
@@ -864,18 +864,17 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
return res;
}
-void cmCoreTryCompile::CleanupFiles(const char* binDir)
+void cmCoreTryCompile::CleanupFiles(std::string const& binDir)
{
- if (!binDir) {
+ if (binDir.empty()) {
return;
}
- std::string bdir = binDir;
- if (bdir.find("CMakeTmp") == std::string::npos) {
+ if (binDir.find("CMakeTmp") == std::string::npos) {
cmSystemTools::Error(
"TRY_COMPILE attempt to remove -rf directory that does not contain "
"CMakeTmp:",
- binDir);
+ binDir.c_str());
return;
}
@@ -889,7 +888,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
std::string const fullPath =
std::string(binDir).append("/").append(fileName);
if (cmSystemTools::FileIsDirectory(fullPath)) {
- this->CleanupFiles(fullPath.c_str());
+ this->CleanupFiles(fullPath);
cmSystemTools::RemoveADirectory(fullPath);
} else {
#ifdef _WIN32
@@ -897,9 +896,8 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
// cannot delete them immediately. Try a few times.
cmSystemTools::WindowsFileRetry retry =
cmSystemTools::GetWindowsFileRetry();
- while (!cmSystemTools::RemoveFile(fullPath.c_str()) &&
- --retry.Count &&
- cmSystemTools::FileExists(fullPath.c_str())) {
+ while (!cmSystemTools::RemoveFile(fullPath) && --retry.Count &&
+ cmSystemTools::FileExists(fullPath)) {
cmSystemTools::Delay(retry.Delay);
}
if (retry.Count == 0)
@@ -959,7 +957,7 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
std::string command = this->BinaryDirectory;
command += sdir;
command += tmpOutputFile;
- if (cmSystemTools::FileExists(command.c_str())) {
+ if (cmSystemTools::FileExists(command)) {
this->OutputFile = cmSystemTools::CollapseFullPath(command);
return;
}
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index 365154d..6f35a54 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -33,7 +33,7 @@ protected:
* This way we do not have to rely on the timing and
* dependencies of makefiles.
*/
- void CleanupFiles(const char* binDir);
+ void CleanupFiles(std::string const& binDir);
/**
* This tries to find the (executable) file created by
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index e3951c1..0f5119e 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -51,7 +51,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config),
result);
for (std::string& it : result) {
- if (cmSystemTools::FileIsFullPath(it.c_str())) {
+ if (cmSystemTools::FileIsFullPath(it)) {
it = cmSystemTools::CollapseFullPath(it);
}
}
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 29755d9..62bc8d9 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -131,14 +131,12 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// If not a full path, find the file in the include path.
std::string fullName;
- if ((srcFiles > 0) ||
- cmSystemTools::FileIsFullPath(current.FileName.c_str())) {
- if (cmSystemTools::FileExists(current.FileName.c_str(), true)) {
+ if ((srcFiles > 0) || cmSystemTools::FileIsFullPath(current.FileName)) {
+ if (cmSystemTools::FileExists(current.FileName, true)) {
fullName = current.FileName;
}
} else if (!current.QuotedLocation.empty() &&
- cmSystemTools::FileExists(current.QuotedLocation.c_str(),
- true)) {
+ cmSystemTools::FileExists(current.QuotedLocation, true)) {
// The include statement producing this entry was a double-quote
// include and the included file is present in the directory of
// the source containing the include statement.
@@ -157,7 +155,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
cmSystemTools::CollapseCombinedPath(i, current.FileName);
// Look for the file in this location.
- if (cmSystemTools::FileExists(tempPathStr.c_str(), true)) {
+ if (cmSystemTools::FileExists(tempPathStr, true)) {
fullName = tempPathStr;
HeaderLocationCache[current.FileName] = fullName;
break;
@@ -226,15 +224,14 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// directory. We must do the same here.
std::string binDir = this->LocalGenerator->GetBinaryDirectory();
std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj);
- std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str());
+ std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i);
internalDepends << obj_i << std::endl;
for (std::string const& dep : dependencies) {
- makeDepends
- << obj_m << ": "
- << cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator->ConvertToRelativePath(binDir, dep).c_str())
- << std::endl;
+ makeDepends << obj_m << ": "
+ << cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator->ConvertToRelativePath(binDir, dep))
+ << std::endl;
internalDepends << " " << dep << std::endl;
}
makeDepends << std::endl;
@@ -363,7 +360,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
entry.FileName = this->IncludeRegexLine.match(2);
cmSystemTools::ConvertToUnixSlashes(entry.FileName);
if (this->IncludeRegexLine.match(3) == "\"" &&
- !cmSystemTools::FileIsFullPath(entry.FileName.c_str())) {
+ !cmSystemTools::FileIsFullPath(entry.FileName)) {
// This was a double-quoted include with a relative path. We
// must check for the file in the directory containing the
// file we are scanning.
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 25d78c4..1a66ca0 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -312,13 +312,13 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
// Write the include dependencies to the output stream.
std::string binDir = this->LocalGenerator->GetBinaryDirectory();
std::string obj_i = this->MaybeConvertToRelativePath(binDir, obj);
- std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str());
+ std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i);
internalDepends << obj_i << std::endl;
internalDepends << " " << src << std::endl;
for (std::string const& i : info.Includes) {
makeDepends << obj_m << ": "
<< cmSystemTools::ConvertToOutputPath(
- this->MaybeConvertToRelativePath(binDir, i).c_str())
+ this->MaybeConvertToRelativePath(binDir, i))
<< std::endl;
internalDepends << " " << i << std::endl;
}
@@ -341,7 +341,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
if (!required->second.empty()) {
// This module is known. Depend on its timestamp file.
std::string stampFile = cmSystemTools::ConvertToOutputPath(
- this->MaybeConvertToRelativePath(binDir, required->second).c_str());
+ this->MaybeConvertToRelativePath(binDir, required->second));
makeDepends << obj_m << ": " << stampFile << "\n";
} else {
// This module is not known to CMake. Try to locate it where
@@ -349,7 +349,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
std::string module;
if (this->FindModule(i, module)) {
module = cmSystemTools::ConvertToOutputPath(
- this->MaybeConvertToRelativePath(binDir, module).c_str());
+ this->MaybeConvertToRelativePath(binDir, module));
makeDepends << obj_m << ": " << module << "\n";
}
}
@@ -382,7 +382,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
this->LocalGenerator->ConvertToOutputFormat(stampFile,
cmOutputConverter::SHELL);
std::string const stampFileForMake =
- cmSystemTools::ConvertToOutputPath(stampFile.c_str());
+ cmSystemTools::ConvertToOutputPath(stampFile);
makeDepends << obj_m << ".provides.build"
<< ": " << stampFileForMake << "\n";
@@ -413,7 +413,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
std::string driver = this->TargetDirectory;
driver += "/build";
driver = cmSystemTools::ConvertToOutputPath(
- this->MaybeConvertToRelativePath(binDir, driver).c_str());
+ this->MaybeConvertToRelativePath(binDir, driver));
makeDepends << driver << ": " << obj_m << ".provides.build\n";
}
@@ -435,7 +435,7 @@ bool cmDependsFortran::FindModule(std::string const& name, std::string& module)
fullName = ip;
fullName += "/";
fullName += mod_lower;
- if (cmSystemTools::FileExists(fullName.c_str(), true)) {
+ if (cmSystemTools::FileExists(fullName, true)) {
module = fullName;
return true;
}
@@ -444,7 +444,7 @@ bool cmDependsFortran::FindModule(std::string const& name, std::string& module)
fullName = ip;
fullName += "/";
fullName += mod_upper;
- if (cmSystemTools::FileExists(fullName.c_str(), true)) {
+ if (cmSystemTools::FileExists(fullName, true)) {
module = fullName;
return true;
}
@@ -481,7 +481,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
mod += ".mod";
mod_upper += ".mod";
mod_lower += ".mod";
- if (cmSystemTools::FileExists(mod_upper.c_str(), true)) {
+ if (cmSystemTools::FileExists(mod_upper, true)) {
if (cmDependsFortran::ModulesDiffer(mod_upper.c_str(), stamp.c_str(),
compilerId.c_str())) {
if (!cmSystemTools::CopyFileAlways(mod_upper, stamp)) {
@@ -492,7 +492,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
}
return true;
}
- if (cmSystemTools::FileExists(mod_lower.c_str(), true)) {
+ if (cmSystemTools::FileExists(mod_lower, true)) {
if (cmDependsFortran::ModulesDiffer(mod_lower.c_str(), stamp.c_str(),
compilerId.c_str())) {
if (!cmSystemTools::CopyFileAlways(mod_lower, stamp)) {
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index 88e085d..49f880c 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -81,7 +81,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
std::string output;
bool result = true;
if (args.size() - count == 2) {
- cmSystemTools::MakeDirectory(args[1].c_str());
+ cmSystemTools::MakeDirectory(args[1]);
result = cmExecProgramCommand::RunCommand(command.c_str(), output, retVal,
args[1].c_str(), verbose);
} else {
@@ -149,7 +149,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
if (quoted.find(command)) {
std::string cmd = quoted.match(1);
std::string args = quoted.match(2);
- if (!cmSystemTools::FileExists(cmd.c_str())) {
+ if (!cmSystemTools::FileExists(cmd)) {
shortCmd = cmd;
} else if (!cmSystemTools::GetShortPath(cmd.c_str(), shortCmd)) {
cmSystemTools::Error("GetShortPath failed for ", cmd.c_str());
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 39e774e..679a648 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -157,7 +157,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
}
}
- if (!this->Makefile->CanIWriteThisFile(output_file.c_str())) {
+ if (!this->Makefile->CanIWriteThisFile(output_file)) {
std::string e = "attempted to output into a file: " + output_file +
" into a source directory.";
this->SetError(e);
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 5e2cd53..6f31a2d 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -48,8 +48,7 @@ void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode(
os << "LOCAL_MODULE := ";
os << targetName << "\n";
os << "LOCAL_SRC_FILES := ";
- std::string path =
- cmSystemTools::ConvertToOutputPath(target->GetFullPath().c_str());
+ std::string path = cmSystemTools::ConvertToOutputPath(target->GetFullPath());
os << path << "\n";
}
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 1e112eb..c8a727d 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -92,8 +92,8 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args,
}
// Get the file to write.
- if (cmSystemTools::FileIsFullPath(fname.c_str())) {
- if (!this->Makefile->CanIWriteThisFile(fname.c_str())) {
+ if (cmSystemTools::FileIsFullPath(fname)) {
+ if (!this->Makefile->CanIWriteThisFile(fname)) {
std::ostringstream e;
e << "FILE option given filename \"" << fname
<< "\" which is in the source tree.\n";
@@ -346,10 +346,10 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
fname += "/.cmake/packages/";
fname += package;
#endif
- cmSystemTools::MakeDirectory(fname.c_str());
+ cmSystemTools::MakeDirectory(fname);
fname += "/";
fname += hash;
- if (!cmSystemTools::FileExists(fname.c_str())) {
+ if (!cmSystemTools::FileExists(fname)) {
cmGeneratedFileStream entry(fname.c_str(), true);
if (entry) {
entry << content << "\n";
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 7985d0f..434abdc 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -183,7 +183,7 @@ bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty(
return false;
}
-static bool isSubDirectory(const char* a, const char* b)
+static bool isSubDirectory(std::string const& a, std::string const& b)
{
return (cmSystemTools::ComparePath(a, b) ||
cmSystemTools::IsSubDirectory(a, b));
@@ -195,13 +195,15 @@ static bool checkInterfaceDirs(const std::string& prepro,
{
const char* installDir =
target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
- const char* topSourceDir = target->GetLocalGenerator()->GetSourceDirectory();
- const char* topBinaryDir = target->GetLocalGenerator()->GetBinaryDirectory();
+ std::string const& topSourceDir =
+ target->GetLocalGenerator()->GetSourceDirectory();
+ std::string const& topBinaryDir =
+ target->GetLocalGenerator()->GetBinaryDirectory();
std::vector<std::string> parts;
cmGeneratorExpression::Split(prepro, parts);
- const bool inSourceBuild = strcmp(topSourceDir, topBinaryDir) == 0;
+ const bool inSourceBuild = topSourceDir == topBinaryDir;
bool hadFatalError = false;
@@ -231,10 +233,10 @@ static bool checkInterfaceDirs(const std::string& prepro,
hadFatalError = true;
}
}
- if (cmHasLiteralPrefix(li.c_str(), "${_IMPORT_PREFIX}")) {
+ if (cmHasLiteralPrefix(li, "${_IMPORT_PREFIX}")) {
continue;
}
- if (!cmSystemTools::FileIsFullPath(li.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(li)) {
/* clang-format off */
e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains relative path:\n"
@@ -242,9 +244,9 @@ static bool checkInterfaceDirs(const std::string& prepro,
/* clang-format on */
target->GetLocalGenerator()->IssueMessage(messageType, e.str());
}
- bool inBinary = isSubDirectory(li.c_str(), topBinaryDir);
- bool inSource = isSubDirectory(li.c_str(), topSourceDir);
- if (isSubDirectory(li.c_str(), installDir)) {
+ bool inBinary = isSubDirectory(li, topBinaryDir);
+ bool inSource = isSubDirectory(li, topSourceDir);
+ if (isSubDirectory(li, installDir)) {
// The include directory is inside the install tree. If the
// install tree is not inside the source tree or build tree then
// fall through to the checks below that the include directory is not
@@ -317,7 +319,7 @@ static void prefixItems(std::string& exportDirs)
for (std::string const& e : entries) {
exportDirs += sep;
sep = ";";
- if (!cmSystemTools::FileIsFullPath(e.c_str()) &&
+ if (!cmSystemTools::FileIsFullPath(e) &&
e.find("${_IMPORT_PREFIX}") == std::string::npos) {
exportDirs += "${_IMPORT_PREFIX}/";
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 1979b15..954b561 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -185,12 +185,12 @@ void cmExportInstallFileGenerator::GenerateImportPrefix(std::ostream& os)
os << "# Compute the installation prefix relative to this file.\n"
<< "get_filename_component(_IMPORT_PREFIX"
<< " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n";
- if (cmHasLiteralPrefix(absDestS.c_str(), "/lib/") ||
- cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") ||
- cmHasLiteralPrefix(absDestS.c_str(), "/libx32/") ||
- cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") ||
- cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/") ||
- cmHasLiteralPrefix(absDestS.c_str(), "/usr/libx32/")) {
+ if (cmHasLiteralPrefix(absDestS, "/lib/") ||
+ cmHasLiteralPrefix(absDestS, "/lib64/") ||
+ cmHasLiteralPrefix(absDestS, "/libx32/") ||
+ cmHasLiteralPrefix(absDestS, "/usr/lib/") ||
+ cmHasLiteralPrefix(absDestS, "/usr/lib64/") ||
+ cmHasLiteralPrefix(absDestS, "/usr/libx32/")) {
// Handle "/usr move" symlinks created by some Linux distros.
/* clang-format off */
os <<
@@ -370,7 +370,7 @@ void cmExportInstallFileGenerator::SetImportLocationProperty(
// Construct the installed location of the target.
std::string dest = itgen->GetDestination(config);
std::string value;
- if (!cmSystemTools::FileIsFullPath(dest.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(dest)) {
// The target is installed relative to the installation prefix.
value = "${_IMPORT_PREFIX}/";
}
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index e4bec7f..4b95140 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -5,7 +5,6 @@
#include <map>
#include <ostream>
#include <set>
-#include <string.h>
#include <utility>
#include "cmAlgorithms.h"
@@ -225,7 +224,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
}
const std::string& relative = cmSystemTools::RelativePath(
- it.second[0]->GetSourceDirectory(), listFile.c_str());
+ it.second[0]->GetSourceDirectory(), listFile);
std::vector<std::string> splitted;
cmSystemTools::SplitPath(relative, splitted, false);
// Split filename from path
@@ -296,8 +295,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
case cmStateEnums::GLOBAL_TARGET: {
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
- if (strcmp(lg->GetCurrentBinaryDirectory(),
- lg->GetBinaryDirectory()) == 0) {
+ if (lg->GetCurrentBinaryDirectory() == lg->GetBinaryDirectory()) {
this->AppendTarget(xml, targetName, nullptr, make.c_str(), lg,
compiler.c_str(), makeArgs);
}
@@ -382,12 +380,12 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
std::string const& fullPath = s->GetFullPath();
// Check file position relative to project root dir.
- const std::string& relative = cmSystemTools::RelativePath(
- (*lg).GetSourceDirectory(), fullPath.c_str());
+ const std::string& relative =
+ cmSystemTools::RelativePath(lg->GetSourceDirectory(), fullPath);
// Do not add this file if it has ".." in relative path and
// if CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable is on.
const bool excludeExternal =
- cmSystemTools::IsOn((*lg).GetMakefile()->GetSafeDefinition(
+ cmSystemTools::IsOn(lg->GetMakefile()->GetSafeDefinition(
"CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES"));
if (excludeExternal &&
(relative.find("..") != std::string::npos)) {
@@ -433,7 +431,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
break;
}
- if (cmSystemTools::FileExists(hname.c_str())) {
+ if (cmSystemTools::FileExists(hname)) {
allFiles[hname].Targets = allFiles[fileName].Targets;
break;
}
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index a37348d..4dbaa3f 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -64,8 +64,8 @@ void cmExtraCodeLiteGenerator::Generate()
const cmMakefile* mf = it.second[0]->GetMakefile();
this->ConfigName = GetConfigurationName(mf);
- if (strcmp(it.second[0]->GetCurrentBinaryDirectory(),
- it.second[0]->GetBinaryDirectory()) == 0) {
+ if (it.second[0]->GetCurrentBinaryDirectory() ==
+ it.second[0]->GetBinaryDirectory()) {
workspaceOutputDir = it.second[0]->GetCurrentBinaryDirectory();
workspaceProjectName = it.second[0]->GetProjectName();
workspaceSourcePath = it.second[0]->GetSourceDirectory();
@@ -127,8 +127,8 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget(
std::string filename = outputDir + "/" + targetName + ".project";
retval.push_back(targetName);
// Make the project file relative to the workspace
- std::string relafilename = cmSystemTools::RelativePath(
- this->WorkspacePath.c_str(), filename.c_str());
+ std::string relafilename =
+ cmSystemTools::RelativePath(this->WorkspacePath, filename);
std::string visualname = targetName;
switch (type) {
case cmStateEnums::SHARED_LIBRARY:
@@ -167,8 +167,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByProjectMaps(
std::string filename = outputDir + "/" + projectName + ".project";
// Make the project file relative to the workspace
- filename = cmSystemTools::RelativePath(this->WorkspacePath.c_str(),
- filename.c_str());
+ filename = cmSystemTools::RelativePath(this->WorkspacePath, filename);
// create a project file
this->CreateProjectFile(it.second);
@@ -318,7 +317,7 @@ void cmExtraCodeLiteGenerator::FindMatchingHeaderfiles(
break;
}
- if (cmSystemTools::FileExists(hname.c_str())) {
+ if (cmSystemTools::FileExists(hname)) {
otherFiles.insert(hname);
break;
}
@@ -335,8 +334,7 @@ void cmExtraCodeLiteGenerator::CreateFoldersAndFiles(
size_t numOfEndEl = 0;
for (std::string const& cFile : cFiles) {
- std::string frelapath =
- cmSystemTools::RelativePath(projectPath.c_str(), cFile.c_str());
+ std::string frelapath = cmSystemTools::RelativePath(projectPath, cFile);
cmsys::SystemTools::SplitPath(frelapath, components, false);
components.pop_back(); // erase last member -> it is file, not folder
components.erase(components.begin()); // erase "root"
@@ -474,8 +472,7 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries(
std::string outputPath = mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
std::string relapath;
if (!outputPath.empty()) {
- relapath = cmSystemTools::RelativePath(this->WorkspacePath.c_str(),
- outputPath.c_str());
+ relapath = cmSystemTools::RelativePath(this->WorkspacePath, outputPath);
xml.Attribute("OutputFile", relapath + "/$(ProjectName)");
} else {
xml.Attribute("OutputFile", "$(IntermediateDirectory)/$(ProjectName)");
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 79cc6ef..7a83e41 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -81,12 +81,12 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
const std::string makeArgs =
mf->GetSafeDefinition("CMAKE_KATE_MAKE_ARGUMENTS");
- const char* homeOutputDir = lg->GetBinaryDirectory();
+ std::string const& homeOutputDir = lg->GetBinaryDirectory();
/* clang-format off */
fout <<
"\t\"build\": {\n"
- "\t\t\"directory\": \"" << lg->GetBinaryDirectory() << "\",\n"
+ "\t\t\"directory\": \"" << homeOutputDir << "\",\n"
"\t\t\"default_target\": \"all\",\n"
"\t\t\"clean_target\": \"clean\",\n";
/* clang-format on */
@@ -195,13 +195,13 @@ void cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout,
const std::string& make,
const std::string& makeArgs,
const std::string& path,
- const char* homeOutputDir) const
+ const std::string& homeOutputDir) const
{
static char JsonSep = ' ';
fout << "\t\t\t" << JsonSep << "{\"name\":\"" << target << "\", "
"\"build_cmd\":\""
- << make << " -C \\\"" << (this->UseNinja ? homeOutputDir : path.c_str())
+ << make << " -C \\\"" << (this->UseNinja ? homeOutputDir : path)
<< "\\\" " << makeArgs << " " << target << "\"}\n";
JsonSep = ',';
@@ -228,14 +228,14 @@ std::string cmExtraKateGenerator::GenerateFilesString(
{
std::string s = lg->GetSourceDirectory();
s += "/.git";
- if (cmSystemTools::FileExists(s.c_str())) {
- return std::string("\"git\": 1 ");
+ if (cmSystemTools::FileExists(s)) {
+ return "\"git\": 1 ";
}
s = lg->GetSourceDirectory();
s += "/.svn";
- if (cmSystemTools::FileExists(s.c_str())) {
- return std::string("\"svn\": 1 ");
+ if (cmSystemTools::FileExists(s)) {
+ return "\"svn\": 1 ";
}
s = lg->GetSourceDirectory();
diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h
index 9716fe7..a4355f0 100644
--- a/Source/cmExtraKateGenerator.h
+++ b/Source/cmExtraKateGenerator.h
@@ -31,7 +31,8 @@ private:
cmGeneratedFileStream& fout) const;
void AppendTarget(cmGeneratedFileStream& fout, const std::string& target,
const std::string& make, const std::string& makeArgs,
- const std::string& path, const char* homeOutputDir) const;
+ const std::string& path,
+ const std::string& homeOutputDir) const;
std::string GenerateFilesString(const cmLocalGenerator* lg) const;
std::string GetPathBasename(const std::string& path) const;
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index a89c187..46dcaf6 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -188,8 +188,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
case cmStateEnums::GLOBAL_TARGET: {
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
- if (strcmp(lg->GetCurrentBinaryDirectory(),
- lg->GetBinaryDirectory()) == 0) {
+ if (lg->GetCurrentBinaryDirectory() == lg->GetBinaryDirectory()) {
this->AppendTarget(fout, targetName, lg, nullptr, make.c_str(),
makefile, compiler.c_str(), sourceFileFlags,
false);
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index b7ab539..d3dcc01 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -183,14 +183,14 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
i++; // Get rid of subcommand
std::string fileName = *i;
- if (!cmsys::SystemTools::FileIsFullPath(i->c_str())) {
+ if (!cmsys::SystemTools::FileIsFullPath(*i)) {
fileName = this->Makefile->GetCurrentSourceDirectory();
fileName += "/" + *i;
}
i++;
- if (!this->Makefile->CanIWriteThisFile(fileName.c_str())) {
+ if (!this->Makefile->CanIWriteThisFile(fileName)) {
std::string e =
"attempted to write a file: " + fileName + " into a source directory.";
this->SetError(e);
@@ -198,7 +198,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
return false;
}
std::string dir = cmSystemTools::GetFilenamePath(fileName);
- cmSystemTools::MakeDirectory(dir.c_str());
+ cmSystemTools::MakeDirectory(dir);
mode_t mode = 0;
@@ -258,7 +258,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
argHelper.Parse(&args, nullptr);
std::string fileName = fileNameArg.GetString();
- if (!cmsys::SystemTools::FileIsFullPath(fileName.c_str())) {
+ if (!cmsys::SystemTools::FileIsFullPath(fileName)) {
fileName = this->Makefile->GetCurrentSourceDirectory();
fileName += "/" + fileNameArg.GetString();
}
@@ -374,7 +374,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// Get the file to read.
std::string fileName = args[1];
- if (!cmsys::SystemTools::FileIsFullPath(fileName.c_str())) {
+ if (!cmsys::SystemTools::FileIsFullPath(fileName)) {
fileName = this->Makefile->GetCurrentSourceDirectory();
fileName += "/" + args[1];
}
@@ -800,7 +800,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
}
cmsys::Glob::GlobMessages globMessages;
- if (!cmsys::SystemTools::FileIsFullPath(i->c_str())) {
+ if (!cmsys::SystemTools::FileIsFullPath(*i)) {
std::string expr = this->Makefile->GetCurrentSourceDirectory();
// Handle script mode
if (!expr.empty()) {
@@ -884,19 +884,19 @@ bool cmFileCommand::HandleMakeDirectoryCommand(
std::string expr;
for (; i != args.end(); ++i) {
const std::string* cdir = &(*i);
- if (!cmsys::SystemTools::FileIsFullPath(i->c_str())) {
+ if (!cmsys::SystemTools::FileIsFullPath(*i)) {
expr = this->Makefile->GetCurrentSourceDirectory();
expr += "/" + *i;
cdir = &expr;
}
- if (!this->Makefile->CanIWriteThisFile(cdir->c_str())) {
+ if (!this->Makefile->CanIWriteThisFile(*cdir)) {
std::string e = "attempted to create a directory: " + *cdir +
" into a source directory.";
this->SetError(e);
cmSystemTools::SetFatalErrorOccured();
return false;
}
- if (!cmSystemTools::MakeDirectory(cdir->c_str())) {
+ if (!cmSystemTools::MakeDirectory(*cdir)) {
std::string error = "problem creating directory: " + *cdir;
this->SetError(error);
return false;
@@ -1294,7 +1294,7 @@ bool cmFileCopier::CheckValue(std::string const& arg)
this->Files.push_back(arg);
break;
case DoingDestination:
- if (arg.empty() || cmSystemTools::FileIsFullPath(arg.c_str())) {
+ if (arg.empty() || cmSystemTools::FileIsFullPath(arg)) {
this->Destination = arg;
} else {
this->Destination = this->Makefile->GetCurrentBinaryDirectory();
@@ -1303,7 +1303,7 @@ bool cmFileCopier::CheckValue(std::string const& arg)
this->Doing = DoingNone;
break;
case DoingFilesFromDir:
- if (cmSystemTools::FileIsFullPath(arg.c_str())) {
+ if (cmSystemTools::FileIsFullPath(arg)) {
this->FilesFromDir = arg;
} else {
this->FilesFromDir = this->Makefile->GetCurrentSourceDirectory();
@@ -1991,7 +1991,7 @@ bool cmFileInstaller::HandleInstallDestination()
}
if (this->InstallType != cmInstallType_DIRECTORY) {
- if (!cmSystemTools::FileExists(destination.c_str())) {
+ if (!cmSystemTools::FileExists(destination)) {
if (!cmSystemTools::MakeDirectory(destination, default_dir_mode)) {
std::string errstring = "cannot create directory: " + destination +
". Maybe need administrative privileges.";
@@ -2293,22 +2293,21 @@ bool cmFileCommand::HandleRelativePathCommand(
const std::string& directoryName = args[2];
const std::string& fileName = args[3];
- if (!cmSystemTools::FileIsFullPath(directoryName.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(directoryName)) {
std::string errstring =
"RELATIVE_PATH must be passed a full path to the directory: " +
directoryName;
this->SetError(errstring);
return false;
}
- if (!cmSystemTools::FileIsFullPath(fileName.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(fileName)) {
std::string errstring =
"RELATIVE_PATH must be passed a full path to the file: " + fileName;
this->SetError(errstring);
return false;
}
- std::string res =
- cmSystemTools::RelativePath(directoryName.c_str(), fileName.c_str());
+ std::string res = cmSystemTools::RelativePath(directoryName, fileName);
this->Makefile->AddDefinition(outVar, res.c_str());
return true;
}
@@ -2322,12 +2321,12 @@ bool cmFileCommand::HandleRename(std::vector<std::string> const& args)
// Compute full path for old and new names.
std::string oldname = args[1];
- if (!cmsys::SystemTools::FileIsFullPath(oldname.c_str())) {
+ if (!cmsys::SystemTools::FileIsFullPath(oldname)) {
oldname = this->Makefile->GetCurrentSourceDirectory();
oldname += "/" + args[1];
}
std::string newname = args[2];
- if (!cmsys::SystemTools::FileIsFullPath(newname.c_str())) {
+ if (!cmsys::SystemTools::FileIsFullPath(newname)) {
newname = this->Makefile->GetCurrentSourceDirectory();
newname += "/" + args[2];
}
@@ -2358,7 +2357,7 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args,
i++; // Get rid of subcommand
for (; i != args.end(); ++i) {
std::string fileName = *i;
- if (!cmsys::SystemTools::FileIsFullPath(fileName.c_str())) {
+ if (!cmsys::SystemTools::FileIsFullPath(fileName)) {
fileName = this->Makefile->GetCurrentSourceDirectory();
fileName += "/" + *i;
}
@@ -2400,7 +2399,7 @@ bool cmFileCommand::HandleCMakePathCommand(
if (!nativePath) {
cmSystemTools::ConvertToUnixSlashes(*j);
} else {
- *j = cmSystemTools::ConvertToOutputPath(j->c_str());
+ *j = cmSystemTools::ConvertToOutputPath(*j);
// remove double quotes in the path
cmsys::String& s = *j;
@@ -2736,7 +2735,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
// and the existing file already has the expected hash, then simply
// return.
//
- if (cmSystemTools::FileExists(file.c_str()) && hash.get()) {
+ if (cmSystemTools::FileExists(file) && hash.get()) {
std::string msg;
std::string actualHash = hash->HashFile(file);
if (actualHash == expectedHash) {
@@ -2755,8 +2754,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
// as we receive downloaded bits from curl...
//
std::string dir = cmSystemTools::GetFilenamePath(file);
- if (!cmSystemTools::FileExists(dir.c_str()) &&
- !cmSystemTools::MakeDirectory(dir.c_str())) {
+ if (!cmSystemTools::FileExists(dir) && !cmSystemTools::MakeDirectory(dir)) {
std::string errstring = "DOWNLOAD error: cannot create directory '" + dir +
"' - Specify file by full path name and verify that you "
"have directory creation and file write privileges.";
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 0af6fce..02bae82 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -353,7 +353,7 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
if (name.TryRaw) {
this->TestPath = path;
this->TestPath += name.Raw;
- if (cmSystemTools::FileExists(this->TestPath.c_str(), true)) {
+ if (cmSystemTools::FileExists(this->TestPath, true)) {
this->BestPath = cmSystemTools::CollapseFullPath(this->TestPath);
cmSystemTools::ConvertToUnixSlashes(this->BestPath);
return true;
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 293a967..2f3a85b 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -660,7 +660,7 @@ bool cmFindPackageCommand::HandlePackageMode()
cmSystemTools::ConvertToUnixSlashes(dir);
// Treat relative paths with respect to the current source dir.
- if (!cmSystemTools::FileIsFullPath(dir.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(dir)) {
dir = "/" + dir;
dir = this->Makefile->GetCurrentSourceDirectory() + dir;
}
@@ -1346,10 +1346,10 @@ bool cmFindPackageCommand::CheckPackageRegistryEntry(const std::string& fname,
cmSearchPath& outPaths)
{
// Parse the content of one package registry entry.
- if (cmSystemTools::FileIsFullPath(fname.c_str())) {
+ if (cmSystemTools::FileIsFullPath(fname)) {
// The first line in the stream is the full path to a file or
// directory containing the package.
- if (cmSystemTools::FileExists(fname.c_str())) {
+ if (cmSystemTools::FileExists(fname)) {
// The path exists. Look for the package here.
if (!cmSystemTools::FileIsDirectory(fname)) {
outPaths.AddPath(cmSystemTools::GetFilenamePath(fname));
@@ -1442,8 +1442,7 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
if (this->DebugMode) {
fprintf(stderr, "Checking file [%s]\n", file.c_str());
}
- if (cmSystemTools::FileExists(file.c_str(), true) &&
- this->CheckVersion(file)) {
+ if (cmSystemTools::FileExists(file, true) && this->CheckVersion(file)) {
return true;
}
}
@@ -1463,7 +1462,7 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
// Look for foo-config-version.cmake
std::string version_file = version_file_base;
version_file += "-version.cmake";
- if (!haveResult && cmSystemTools::FileExists(version_file.c_str(), true)) {
+ if (!haveResult && cmSystemTools::FileExists(version_file, true)) {
result = this->CheckVersionFile(version_file, version);
haveResult = true;
}
@@ -1471,7 +1470,7 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
// Look for fooConfigVersion.cmake
version_file = version_file_base;
version_file += "Version.cmake";
- if (!haveResult && cmSystemTools::FileExists(version_file.c_str(), true)) {
+ if (!haveResult && cmSystemTools::FileExists(version_file, true)) {
result = this->CheckVersionFile(version_file, version);
haveResult = true;
}
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index ea26410..38ff2ed 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -94,7 +94,7 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file,
std::string intPath = fpath;
intPath += "/Headers/";
intPath += fileName;
- if (cmSystemTools::FileExists(intPath.c_str())) {
+ if (cmSystemTools::FileExists(intPath)) {
if (this->IncludeFileInPath) {
return intPath;
}
@@ -128,7 +128,7 @@ std::string cmFindPathCommand::FindNormalHeader()
for (std::string const& sp : this->SearchPaths) {
tryPath = sp;
tryPath += n;
- if (cmSystemTools::FileExists(tryPath.c_str())) {
+ if (cmSystemTools::FileExists(tryPath)) {
if (this->IncludeFileInPath) {
return tryPath;
}
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx
index 81f1286..dd4f16b 100644
--- a/Source/cmFortranParserImpl.cxx
+++ b/Source/cmFortranParserImpl.cxx
@@ -17,14 +17,14 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir,
// If the file is a full path, include it directly.
if (cmSystemTools::FileIsFullPath(includeName)) {
fileName = includeName;
- return cmSystemTools::FileExists(fileName.c_str(), true);
+ return cmSystemTools::FileExists(fileName, true);
}
// Check for the file in the directory containing the including
// file.
std::string fullName = dir;
fullName += "/";
fullName += includeName;
- if (cmSystemTools::FileExists(fullName.c_str(), true)) {
+ if (cmSystemTools::FileExists(fullName, true)) {
fileName = fullName;
return true;
}
@@ -34,7 +34,7 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir,
fullName = i;
fullName += "/";
fullName += includeName;
- if (cmSystemTools::FileExists(fullName.c_str(), true)) {
+ if (cmSystemTools::FileExists(fullName, true)) {
fileName = fullName;
return true;
}
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 6aa593c..c0a74a5 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -147,7 +147,7 @@ void cmGeneratedFileStreamBase::Open(const char* name)
cmSystemTools::RemoveFile(this->TempName);
std::string dir = cmSystemTools::GetFilenamePath(this->TempName);
- cmSystemTools::MakeDirectory(dir.c_str());
+ cmSystemTools::MakeDirectory(dir);
}
bool cmGeneratedFileStreamBase::Close()
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 6979b38..64ec30d 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -203,7 +203,7 @@ static void prefixItems(const std::string& content, std::string& result,
for (std::string const& e : entries) {
result += sep;
sep = ";";
- if (!cmSystemTools::FileIsFullPath(e.c_str()) &&
+ if (!cmSystemTools::FileIsFullPath(e) &&
cmGeneratorExpression::Find(e) != 0) {
result += prefix;
}
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 5e3e810..c1f1ee4 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1075,8 +1075,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME)
// Note that the above macro terminates with an else
- /* else */ if (cmHasLiteralPrefix(propertyName.c_str(),
- "COMPILE_DEFINITIONS_")) {
+ /* else */ if (cmHasLiteralPrefix(propertyName, "COMPILE_DEFINITIONS_")) {
cmPolicies::PolicyStatus polSt =
context->LG->GetPolicyStatus(cmPolicies::CMP0043);
if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 449b0c5..e9b6daf 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -842,7 +842,7 @@ static bool processSources(
return contextDependent;
}
- if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src.c_str())) {
+ if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src)) {
std::ostringstream err;
if (!targetName.empty()) {
err << "Target \"" << targetName
@@ -2237,7 +2237,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
// If we find the target and the dep was given as a full path,
// then make sure it was not a full path to something else, and
// the fact that the name matched a target was just a coincidence.
- if (cmSystemTools::FileIsFullPath(dep.c_str())) {
+ if (cmSystemTools::FileIsFullPath(dep)) {
if (t->GetType() >= cmStateEnums::EXECUTABLE &&
t->GetType() <= cmStateEnums::MODULE_LIBRARY) {
// This is really only for compatibility so we do not need to
@@ -2437,7 +2437,7 @@ static void processIncludeDirectories(
std::string usedIncludes;
for (std::string& entryInclude : entryIncludes) {
- if (fromImported && !cmSystemTools::FileExists(entryInclude.c_str())) {
+ if (fromImported && !cmSystemTools::FileExists(entryInclude)) {
std::ostringstream e;
cmake::MessageType messageType = cmake::FATAL_ERROR;
if (checkCMP0027) {
@@ -2469,7 +2469,7 @@ static void processIncludeDirectories(
return;
}
- if (!cmSystemTools::FileIsFullPath(entryInclude.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(entryInclude)) {
std::ostringstream e;
bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR;
@@ -3540,7 +3540,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
for (std::string const& p : props) {
std::string pname = cmSystemTools::HelpFileName(p);
std::string pfile = pdir + pname + ".rst";
- if (cmSystemTools::FileExists(pfile.c_str(), true)) {
+ if (cmSystemTools::FileExists(pfile, true)) {
std::ostringstream e;
e << "Target \"" << dependee->GetName() << "\" has property \"" << p
<< "\" listed in its " << propName
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index a8cf6ab..bf464d9 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -34,7 +34,7 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
}
std::string sd = *i;
// make sure the start dir is a full path
- if (!cmSystemTools::FileIsFullPath(sd.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(sd)) {
sd = this->Makefile->GetCurrentSourceDirectory();
sd += "/";
sd += *i;
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 4494c3e..1d812bd 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -206,7 +206,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode()
// Construct the directory name. Interpret relative paths with
// respect to the current directory.
std::string dir = this->Name;
- if (!cmSystemTools::FileIsFullPath(dir.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(dir)) {
dir = this->Makefile->GetCurrentSourceDirectory();
dir += "/";
dir += this->Name;
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index d459436..270413c 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -493,7 +493,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
cmSystemTools::ConvertToUnixSlashes(sgPath);
cmGlobalGhsMultiGenerator::AddFilesUpToPath(
this->GetFolderBuildStreams(), &this->FolderBuildStreams,
- this->LocalGenerator->GetBinaryDirectory(), sgPath,
+ this->LocalGenerator->GetBinaryDirectory().c_str(), sgPath,
GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath);
std::string fullSourcePath((*si)->GetFullPath());
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 153684a..c805b98 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -510,7 +510,7 @@ void cmGlobalGenerator::EnableLanguage(
bool const readCMakeSystem = !mf->GetDefinition("CMAKE_SYSTEM_LOADED");
if (readCMakeSystem) {
fpath += "/CMakeSystem.cmake";
- if (cmSystemTools::FileExists(fpath.c_str())) {
+ if (cmSystemTools::FileExists(fpath)) {
mf->ReadListFile(fpath.c_str());
}
}
@@ -623,7 +623,7 @@ void cmGlobalGenerator::EnableLanguage(
// If the existing build tree was already configured with this
// version of CMake then try to load the configured file first
// to avoid duplicate compiler tests.
- if (cmSystemTools::FileExists(fpath.c_str())) {
+ if (cmSystemTools::FileExists(fpath)) {
if (!mf->ReadListFile(fpath.c_str())) {
cmSystemTools::Error("Could not find cmake module file: ",
fpath.c_str());
@@ -842,7 +842,7 @@ void cmGlobalGenerator::EnableLanguage(
projectCompatibility += "/Modules/";
projectCompatibility += mf->GetSafeDefinition("PROJECT_NAME");
projectCompatibility += "Compatibility.cmake";
- if (cmSystemTools::FileExists(projectCompatibility.c_str())) {
+ if (cmSystemTools::FileExists(projectCompatibility)) {
mf->ReadListFile(projectCompatibility.c_str());
}
// Inform any extra generator of the new language.
@@ -1205,7 +1205,7 @@ void cmGlobalGenerator::Configure()
f += this->CMakeInstance->GetCMakeFilesDirectory();
f += "/";
f += *log;
- if (cmSystemTools::FileExists(f.c_str())) {
+ if (cmSystemTools::FileExists(f)) {
msg << "\nSee also \"" << f << "\".";
}
}
@@ -1901,7 +1901,7 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
const std::string& native, bool ignoreErrors)
{
std::string makeCommand = cmSystemTools::GetCMakeCommand();
- makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
+ makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand);
makeCommand += " --build .";
if (!config.empty()) {
makeCommand += " --config \"";
@@ -2269,7 +2269,7 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
cmMakefile* mf = this->Makefiles[0];
std::string configFile = mf->GetCurrentBinaryDirectory();
configFile += "/CPackConfig.cmake";
- if (!cmSystemTools::FileExists(configFile.c_str())) {
+ if (!cmSystemTools::FileExists(configFile)) {
return;
}
@@ -2319,7 +2319,7 @@ void cmGlobalGenerator::AddGlobalTarget_PackageSource(
cmMakefile* mf = this->Makefiles[0];
std::string configFile = mf->GetCurrentBinaryDirectory();
configFile += "/CPackSourceConfig.cmake";
- if (!cmSystemTools::FileExists(configFile.c_str())) {
+ if (!cmSystemTools::FileExists(configFile)) {
return;
}
@@ -2854,7 +2854,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
// that if the feature is turned back on and the rule has
// changed the file is still rebuilt.
std::string fpath = cmSystemTools::CollapseFullPath(fname, home.c_str());
- if (cmSystemTools::FileExists(fpath.c_str())) {
+ if (cmSystemTools::FileExists(fpath)) {
RuleHash hash;
strncpy(hash.Data, line.c_str(), 32);
this->RuleHashes[fname] = hash;
@@ -2920,7 +2920,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
Json::Value& lj_target_labels = lj_target["labels"] = Json::arrayValue;
Json::Value& lj_sources = lj_root["sources"] = Json::arrayValue;
- cmSystemTools::MakeDirectory(dir.c_str());
+ cmSystemTools::MakeDirectory(dir);
cmGeneratedFileStream fout(file.c_str());
std::vector<std::string> labels;
@@ -3066,7 +3066,7 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile()
std::string path = this->CMakeInstance->GetHomeOutputDirectory();
path += "/CPackProperties.cmake";
- if (!cmSystemTools::FileExists(path.c_str()) && installedFiles.empty()) {
+ if (!cmSystemTools::FileExists(path) && installedFiles.empty()) {
return true;
}
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 788a179..946ed80 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -447,8 +447,8 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
this->TargetFolderBuildStreams.find(folderName)) {
this->AddFilesUpToPath(
GetBuildFileStream(), &this->TargetFolderBuildStreams,
- this->GetCMakeInstance()->GetHomeOutputDirectory(), folderName,
- GhsMultiGpj::PROJECT);
+ this->GetCMakeInstance()->GetHomeOutputDirectory().c_str(),
+ folderName, GhsMultiGpj::PROJECT);
}
std::vector<cmsys::String> splitPath = cmSystemTools::SplitString(
cmGhsMultiTargetGenerator::GetRelBuildFileName(tgt));
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index eff2e53..b251f86 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -870,7 +870,7 @@ std::string const& cmGlobalNinjaGenerator::ConvertToNinjaPath(
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
- const char* bin_dir = ng->GetState()->GetBinaryDirectory();
+ std::string const& bin_dir = ng->GetState()->GetBinaryDirectory();
std::string convPath = ng->ConvertToRelativePath(bin_dir, path);
convPath = this->NinjaOutputPath(convPath);
#ifdef _WIN32
@@ -902,7 +902,7 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand(
}
std::string sourceFileName = sourceFile;
- if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(sourceFileName)) {
sourceFileName = cmSystemTools::CollapseFullPath(
sourceFileName, this->GetCMakeInstance()->GetHomeOutputDirectory());
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index d6307eb..d990a6c 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -459,10 +459,9 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2(
}
// Begin the directory-level rules section.
- std::string dir = cmSystemTools::ConvertToOutputPath(
- lg->ConvertToRelativePath(lg->GetBinaryDirectory(),
- lg->GetCurrentBinaryDirectory())
- .c_str());
+ std::string dir =
+ cmSystemTools::ConvertToOutputPath(lg->ConvertToRelativePath(
+ lg->GetBinaryDirectory(), lg->GetCurrentBinaryDirectory()));
lg->WriteDivider(ruleFileStream);
ruleFileStream << "# Directory level rules for directory " << dir << "\n\n";
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index d7ebcac..a4570e1 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -916,7 +916,7 @@ bool cmGlobalVisualStudioGenerator::Open(const std::string& bindir,
const std::string& projectName,
bool dryRun)
{
- std::string buildDir = cmSystemTools::ConvertToOutputPath(bindir.c_str());
+ std::string buildDir = cmSystemTools::ConvertToOutputPath(bindir);
std::string sln = buildDir + "\\" + projectName + ".sln";
if (dryRun) {
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 7668fd0..b1afdc9 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3442,7 +3442,8 @@ void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry)
entry.Brief = "Generate Xcode project files.";
}
-std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(const char* p)
+std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(
+ std::string const& p)
{
return cmSystemTools::ConvertToOutputPath(p);
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index d173f7a..b45887e 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -119,7 +119,7 @@ private:
std::string XCodeEscapePath(const std::string& p);
std::string RelativeToSource(const char* p);
std::string RelativeToBinary(const char* p);
- std::string ConvertToRelativeForMake(const char* p);
+ std::string ConvertToRelativeForMake(std::string const& p);
void CreateCustomCommands(cmXCodeObject* buildPhases,
cmXCodeObject* sourceBuildPhase,
cmXCodeObject* headerBuildPhase,
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index cd4d850..b42d75e 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -63,7 +63,7 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
return true;
}
- if (!cmSystemTools::FileIsFullPath(fname.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(fname)) {
// Not a path. Maybe module.
std::string module = fname;
module += ".cmake";
@@ -112,7 +112,7 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
std::string listFile = cmSystemTools::CollapseFullPath(
fname, this->Makefile->GetCurrentSourceDirectory());
- if (optional && !cmSystemTools::FileExists(listFile.c_str())) {
+ if (optional && !cmSystemTools::FileExists(listFile)) {
if (!resultVarName.empty()) {
this->Makefile->AddDefinition(resultVarName, "NOTFOUND");
}
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index 045926a..4f80fb8 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -123,7 +123,7 @@ void cmIncludeDirectoryCommand::NormalizeInclude(std::string& inc)
if (!cmSystemTools::IsOff(inc.c_str())) {
cmSystemTools::ConvertToUnixSlashes(inc);
- if (!cmSystemTools::FileIsFullPath(inc.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(inc)) {
if (!StartsWithGeneratorExpression(inc)) {
std::string tmp = this->Makefile->GetCurrentSourceDirectory();
tmp += "/";
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 208f0ad..394f976 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -155,7 +155,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
} else if (doing_script) {
doing_script = false;
std::string script = arg;
- if (!cmSystemTools::FileIsFullPath(script.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(script)) {
script = this->Makefile->GetCurrentSourceDirectory();
script += "/";
script += arg;
@@ -1045,14 +1045,14 @@ bool cmInstallCommand::HandleDirectoryMode(
// Convert this directory to a full path.
std::string dir = args[i];
std::string::size_type gpos = cmGeneratorExpression::Find(dir);
- if (gpos != 0 && !cmSystemTools::FileIsFullPath(dir.c_str())) {
+ if (gpos != 0 && !cmSystemTools::FileIsFullPath(dir)) {
dir = this->Makefile->GetCurrentSourceDirectory();
dir += "/";
dir += args[i];
}
// Make sure the name is a directory.
- if (cmSystemTools::FileExists(dir.c_str()) &&
+ if (cmSystemTools::FileExists(dir) &&
!cmSystemTools::FileIsDirectory(dir)) {
std::ostringstream e;
e << args[0] << " given non-directory \"" << args[i]
@@ -1375,7 +1375,7 @@ bool cmInstallCommand::MakeFilesFullPath(
for (std::string const& relFile : relFiles) {
std::string file = relFile;
std::string::size_type gpos = cmGeneratorExpression::Find(file);
- if (gpos != 0 && !cmSystemTools::FileIsFullPath(file.c_str())) {
+ if (gpos != 0 && !cmSystemTools::FileIsFullPath(file)) {
file = this->Makefile->GetCurrentSourceDirectory();
file += "/";
file += relFile;
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index e4209bd..b569b73 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -72,7 +72,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
// Make sure all dirs have absolute paths.
cmMakefile const& mf = *this->LocalGenerator->GetMakefile();
for (std::string& d : dirs) {
- if (!cmSystemTools::FileIsFullPath(d.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(d)) {
d = std::string(mf.GetCurrentSourceDirectory()) + "/" + d;
}
}
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index fdd231c..5990f30 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -132,7 +132,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
// Create the temporary directory in which to store the files.
this->ComputeTempDir();
- cmSystemTools::MakeDirectory(this->TempDir.c_str());
+ cmSystemTools::MakeDirectory(this->TempDir);
// Construct a temporary location for the file.
this->MainImportFile = this->TempDir;
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 4b49444..4dde18f 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -137,11 +137,11 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const
ts += "/";
ts += name;
- if (cmSystemTools::FileExists(tb.c_str())) {
+ if (cmSystemTools::FileExists(tb)) {
// The file exists in the binary tree. Use it.
return tb;
}
- if (cmSystemTools::FileExists(ts.c_str())) {
+ if (cmSystemTools::FileExists(ts)) {
// The file exists in the source tree. Use it.
return ts;
}
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 4d01978..53ac716 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -55,7 +55,7 @@ void cmInstallGenerator::AddInstallRule(
break;
}
os << indent;
- if (cmSystemTools::FileIsFullPath(dest.c_str())) {
+ if (cmSystemTools::FileIsFullPath(dest)) {
os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";
os << indent << " \"";
for (std::vector<std::string>::const_iterator fi = files.begin();
@@ -165,7 +165,7 @@ std::string cmInstallGenerator::ConvertToAbsoluteDestination(
std::string const& dest) const
{
std::string result;
- if (!dest.empty() && !cmSystemTools::FileIsFullPath(dest.c_str())) {
+ if (!dest.empty() && !cmSystemTools::FileIsFullPath(dest)) {
result = "${CMAKE_INSTALL_PREFIX}/";
}
result += dest;
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 5ee81fb..f01a4c1 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -109,11 +109,11 @@ std::string cmInstallProgramsCommand::FindInstallSource(const char* name) const
ts += "/";
ts += name;
- if (cmSystemTools::FileExists(tb.c_str())) {
+ if (cmSystemTools::FileExists(tb)) {
// The file exists in the binary tree. Use it.
return tb;
}
- if (cmSystemTools::FileExists(ts.c_str())) {
+ if (cmSystemTools::FileExists(ts)) {
// The file exists in the source tree. Use it.
return ts;
}
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx
index 98ab7e7..1371c53 100644
--- a/Source/cmLinkDirectoriesCommand.cxx
+++ b/Source/cmLinkDirectoriesCommand.cxx
@@ -29,7 +29,7 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir)
{
std::string unixPath = dir;
cmSystemTools::ConvertToUnixSlashes(unixPath);
- if (!cmSystemTools::FileIsFullPath(unixPath.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(unixPath)) {
bool convertToAbsolute = false;
std::ostringstream e;
/* clang-format off */
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 32fdef5..b1fee8d 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -82,7 +82,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector<std::string> const& args)
// Make sure the cache file exists.
std::string cacheFile = args[0] + "/CMakeCache.txt";
- if (!cmSystemTools::FileExists(cacheFile.c_str())) {
+ if (!cmSystemTools::FileExists(cacheFile)) {
std::string e = "Cannot load cache file from " + cacheFile;
this->SetError(e);
return false;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index afdcc84..08f3c0f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -904,8 +904,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
// Support putting all the in-project include directories first if
// it is requested by the project.
if (this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")) {
- const char* topSourceDir = this->GetState()->GetSourceDirectory();
- const char* topBinaryDir = this->GetState()->GetBinaryDirectory();
+ std::string const &topSourceDir = this->GetState()->GetSourceDirectory(),
+ &topBinaryDir = this->GetState()->GetBinaryDirectory();
for (std::string const& i : includes) {
// Emit this directory only if it is a subdirectory of the
// top-level source or binary tree.
@@ -1416,7 +1416,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
if (cmGeneratorTarget* target = this->FindGeneratorTargetToUse(name)) {
// make sure it is not just a coincidence that the target name
// found is part of the inName
- if (cmSystemTools::FileIsFullPath(inName.c_str())) {
+ if (cmSystemTools::FileIsFullPath(inName)) {
std::string tLocation;
if (target->GetType() >= cmStateEnums::EXECUTABLE &&
target->GetType() <= cmStateEnums::MODULE_LIBRARY) {
@@ -1460,7 +1460,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
}
// The name was not that of a CMake target. It must name a file.
- if (cmSystemTools::FileIsFullPath(inName.c_str())) {
+ if (cmSystemTools::FileIsFullPath(inName)) {
// This is a full path. Return it as given.
dep = inName;
return true;
@@ -1966,7 +1966,7 @@ void cmLocalGenerator::AppendIncludeDirectories(
std::unordered_set<std::string> uniqueIncludes;
for (const std::string& include : includes_vec) {
- if (!cmSystemTools::FileIsFullPath(include.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(include)) {
std::ostringstream e;
e << "Found relative path while evaluating include directories of "
"\""
@@ -2389,14 +2389,14 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
std::string relFromSource =
this->ConvertToRelativePath(this->GetCurrentSourceDirectory(), fullPath);
assert(!relFromSource.empty());
- bool relSource = !cmSystemTools::FileIsFullPath(relFromSource.c_str());
+ bool relSource = !cmSystemTools::FileIsFullPath(relFromSource);
bool subSource = relSource && relFromSource[0] != '.';
// Try referencing the source relative to the binary tree.
std::string relFromBinary =
this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), fullPath);
assert(!relFromBinary.empty());
- bool relBinary = !cmSystemTools::FileIsFullPath(relFromBinary.c_str());
+ bool relBinary = !cmSystemTools::FileIsFullPath(relFromBinary);
bool subBinary = relBinary && relFromBinary[0] != '.';
// Select a nice-looking reference to the source file to construct
@@ -2415,7 +2415,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
// if it is still a full path check for the try compile case
// try compile never have in source sources, and should not
// have conflicting source file names in the same target
- if (cmSystemTools::FileIsFullPath(objectName.c_str())) {
+ if (cmSystemTools::FileIsFullPath(objectName)) {
if (this->GetGlobalGenerator()->GetCMakeInstance()->GetIsInTryCompile()) {
objectName = cmSystemTools::GetFilenameName(source.GetFullPath());
}
@@ -2473,12 +2473,12 @@ cmake* cmLocalGenerator::GetCMakeInstance() const
return this->GlobalGenerator->GetCMakeInstance();
}
-const char* cmLocalGenerator::GetSourceDirectory() const
+std::string const& cmLocalGenerator::GetSourceDirectory() const
{
return this->GetCMakeInstance()->GetHomeDirectory();
}
-const char* cmLocalGenerator::GetBinaryDirectory() const
+std::string const& cmLocalGenerator::GetBinaryDirectory() const
{
return this->GetCMakeInstance()->GetHomeOutputDirectory();
}
@@ -2617,13 +2617,13 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
// Find the Info.plist template.
const char* in = target->GetProperty("MACOSX_BUNDLE_INFO_PLIST");
std::string inFile = (in && *in) ? in : "MacOSXBundleInfo.plist.in";
- if (!cmSystemTools::FileIsFullPath(inFile.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(inFile)) {
std::string inMod = this->Makefile->GetModulesFile(inFile.c_str());
if (!inMod.empty()) {
inFile = inMod;
}
}
- if (!cmSystemTools::FileExists(inFile.c_str(), true)) {
+ if (!cmSystemTools::FileExists(inFile, true)) {
std::ostringstream e;
e << "Target " << target->GetName() << " Info.plist template \"" << inFile
<< "\" could not be found.";
@@ -2655,13 +2655,13 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(
// Find the Info.plist template.
const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST");
std::string inFile = (in && *in) ? in : "MacOSXFrameworkInfo.plist.in";
- if (!cmSystemTools::FileIsFullPath(inFile.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(inFile)) {
std::string inMod = this->Makefile->GetModulesFile(inFile.c_str());
if (!inMod.empty()) {
inFile = inMod;
}
}
- if (!cmSystemTools::FileExists(inFile.c_str(), true)) {
+ if (!cmSystemTools::FileExists(inFile, true)) {
std::ostringstream e;
e << "Target " << target->GetName() << " Info.plist template \"" << inFile
<< "\" could not be found.";
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 58bbe77..533ac56 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -287,8 +287,8 @@ public:
cmake* GetCMakeInstance() const;
- const char* GetSourceDirectory() const;
- const char* GetBinaryDirectory() const;
+ std::string const& GetSourceDirectory() const;
+ std::string const& GetBinaryDirectory() const;
const char* GetCurrentBinaryDirectory() const;
const char* GetCurrentSourceDirectory() const;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 12682a7..ddd8cc4 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -172,7 +172,7 @@ void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles(
bool hasSourceExtension = true;
std::string objectName =
this->GetObjectFileNameWithoutTarget(*sf, dir, &hasSourceExtension);
- if (cmSystemTools::FileIsFullPath(objectName.c_str())) {
+ if (cmSystemTools::FileIsFullPath(objectName)) {
objectName = cmSystemTools::GetFilenameName(objectName);
}
LocalObjectInfo& info = localObjectFiles[objectName];
@@ -525,8 +525,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
// Construct the left hand side of the rule.
std::string tgt = cmSystemTools::ConvertToOutputPath(
- this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), target)
- .c_str());
+ this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), target));
const char* space = "";
if (tgt.size() == 1) {
@@ -554,7 +553,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
for (std::string const& depend : depends) {
replace = depend;
replace = cmSystemTools::ConvertToOutputPath(
- this->MaybeConvertToRelativePath(binDir, replace).c_str());
+ this->MaybeConvertToRelativePath(binDir, replace));
os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}
@@ -574,7 +573,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
std::string cmLocalUnixMakefileGenerator3::MaybeConvertWatcomShellCommand(
std::string const& cmd)
{
- if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) &&
+ if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd) &&
cmd.find_first_of("( )") != std::string::npos) {
// On Watcom WMake use the windows short path for the command
// name. This is needed to avoid funny quoting problems on
@@ -1028,7 +1027,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
}
// Setup the proper working directory for the commands.
- this->CreateCDCommand(commands1, dir.c_str(), relative);
+ this->CreateCDCommand(commands1, dir, relative);
// push back the custom commands
commands.insert(commands.end(), commands1.begin(), commands1.end());
@@ -1476,8 +1475,8 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
// If the depender is missing then delete the dependee to make
// sure both will be regenerated.
- if (cmSystemTools::FileExists(dependee.c_str()) &&
- !cmSystemTools::FileExists(depender.c_str())) {
+ if (cmSystemTools::FileExists(dependee) &&
+ !cmSystemTools::FileExists(depender)) {
if (verbose) {
std::ostringstream msg;
msg << "Deleting primary custom command output \"" << dependee
@@ -1828,7 +1827,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
this->GetIncludeDirectories(includes, target, implicitLang.first, config);
std::string binaryDir = this->GetState()->GetBinaryDirectory();
if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) {
- const char* sourceDir = this->GetState()->GetSourceDirectory();
+ std::string const& sourceDir = this->GetState()->GetSourceDirectory();
cmEraseIf(includes, ::NotInProjectDir(sourceDir, binaryDir));
}
for (std::string const& include : includes) {
@@ -2029,7 +2028,7 @@ void cmLocalUnixMakefileGenerator3::AddImplicitDepends(
}
void cmLocalUnixMakefileGenerator3::CreateCDCommand(
- std::vector<std::string>& commands, const char* tgtDir,
+ std::vector<std::string>& commands, std::string const& tgtDir,
std::string const& relDir)
{
// do we need to cd?
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 2d580d5..bc72f1b 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -117,7 +117,8 @@ public:
// create a command that cds to the start dir then runs the commands
void CreateCDCommand(std::vector<std::string>& commands,
- const char* targetDir, std::string const& relDir);
+ std::string const& targetDir,
+ std::string const& relDir);
static std::string ConvertToQuotedOutputPath(const char* p,
bool useWatcomQuote);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index f38cd79..98b1c44 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -115,8 +115,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
void cmLocalVisualStudio7Generator::WriteProjectFiles()
{
// If not an in source build, then create the output directory
- if (strcmp(this->GetCurrentBinaryDirectory(), this->GetSourceDirectory()) !=
- 0) {
+ if (this->GetCurrentBinaryDirectory() != this->GetSourceDirectory()) {
if (!cmSystemTools::MakeDirectory(this->GetCurrentBinaryDirectory())) {
cmSystemTools::Error("Error creating directory ",
this->GetCurrentBinaryDirectory());
diff --git a/Source/cmMakeDirectoryCommand.cxx b/Source/cmMakeDirectoryCommand.cxx
index 06e295b..aff4ca6 100644
--- a/Source/cmMakeDirectoryCommand.cxx
+++ b/Source/cmMakeDirectoryCommand.cxx
@@ -15,13 +15,13 @@ bool cmMakeDirectoryCommand::InitialPass(std::vector<std::string> const& args,
this->SetError("called with incorrect number of arguments");
return false;
}
- if (!this->Makefile->CanIWriteThisFile(args[0].c_str())) {
+ if (!this->Makefile->CanIWriteThisFile(args[0])) {
std::string e = "attempted to create a directory: " + args[0] +
" into a source directory.";
this->SetError(e);
cmSystemTools::SetFatalErrorOccured();
return false;
}
- cmSystemTools::MakeDirectory(args[0].c_str());
+ cmSystemTools::MakeDirectory(args[0]);
return true;
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index bf0720e..b468208 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1104,9 +1104,9 @@ cmTarget* cmMakefile::AddUtilityCommand(
return target;
}
-void cmMakefile::AddDefineFlag(const char* flag)
+void cmMakefile::AddDefineFlag(std::string const& flag)
{
- if (!flag) {
+ if (flag.empty()) {
return;
}
@@ -1122,7 +1122,7 @@ void cmMakefile::AddDefineFlag(const char* flag)
this->AddDefineFlag(flag, this->DefineFlags);
}
-void cmMakefile::AddDefineFlag(const char* flag, std::string& dflags)
+void cmMakefile::AddDefineFlag(std::string const& flag, std::string& dflags)
{
// remove any \n\r
std::string::size_type initSize = dflags.size();
@@ -1132,14 +1132,13 @@ void cmMakefile::AddDefineFlag(const char* flag, std::string& dflags)
std::replace(flagStart, dflags.end(), '\r', ' ');
}
-void cmMakefile::RemoveDefineFlag(const char* flag)
+void cmMakefile::RemoveDefineFlag(std::string const& flag)
{
// Check the length of the flag to remove.
- std::string::size_type len = strlen(flag);
- if (len < 1) {
+ if (flag.empty()) {
return;
}
-
+ std::string::size_type const len = flag.length();
// Update the string used for the old DEFINITIONS property.
this->RemoveDefineFlag(flag, len, this->DefineFlagsOrig);
@@ -1152,7 +1151,8 @@ void cmMakefile::RemoveDefineFlag(const char* flag)
this->RemoveDefineFlag(flag, len, this->DefineFlags);
}
-void cmMakefile::RemoveDefineFlag(const char* flag, std::string::size_type len,
+void cmMakefile::RemoveDefineFlag(std::string const& flag,
+ std::string::size_type len,
std::string& dflags)
{
// Remove all instances of the flag that are surrounded by
@@ -1169,9 +1169,9 @@ void cmMakefile::RemoveDefineFlag(const char* flag, std::string::size_type len,
}
}
-void cmMakefile::AddCompileOption(const char* option)
+void cmMakefile::AddCompileOption(std::string const& option)
{
- this->AppendProperty("COMPILE_OPTIONS", option);
+ this->AppendProperty("COMPILE_OPTIONS", option.c_str());
}
bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
@@ -2292,7 +2292,7 @@ const char* cmMakefile::GetSONameFlag(const std::string& language) const
return GetDefinition(name);
}
-bool cmMakefile::CanIWriteThisFile(const char* fileName) const
+bool cmMakefile::CanIWriteThisFile(std::string const& fileName) const
{
if (!this->IsOn("CMAKE_DISABLE_SOURCE_CHANGES")) {
return true;
@@ -3105,19 +3105,19 @@ std::unique_ptr<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker(
return std::unique_ptr<cmFunctionBlocker>();
}
-const char* cmMakefile::GetHomeDirectory() const
+std::string const& cmMakefile::GetHomeDirectory() const
{
return this->GetCMakeInstance()->GetHomeDirectory();
}
-const char* cmMakefile::GetHomeOutputDirectory() const
+std::string const& cmMakefile::GetHomeOutputDirectory() const
{
return this->GetCMakeInstance()->GetHomeOutputDirectory();
}
-void cmMakefile::SetScriptModeFile(const char* scriptfile)
+void cmMakefile::SetScriptModeFile(std::string const& scriptfile)
{
- this->AddDefinition("CMAKE_SCRIPT_MODE_FILE", scriptfile);
+ this->AddDefinition("CMAKE_SCRIPT_MODE_FILE", scriptfile.c_str());
}
void cmMakefile::SetArgcArgv(const std::vector<std::string>& args)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 2721277..5a30790 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -166,9 +166,9 @@ public:
/**
* Add a define flag to the build.
*/
- void AddDefineFlag(const char* definition);
- void RemoveDefineFlag(const char* definition);
- void AddCompileOption(const char* option);
+ void AddDefineFlag(std::string const& definition);
+ void RemoveDefineFlag(std::string const& definition);
+ void AddCompileOption(std::string const& option);
/** Create a new imported target with the name and type given. */
cmTarget* AddImportedTarget(const std::string& name,
@@ -309,13 +309,13 @@ public:
bool IgnoreErrorsCMP0061() const;
- const char* GetHomeDirectory() const;
- const char* GetHomeOutputDirectory() const;
+ std::string const& GetHomeDirectory() const;
+ std::string const& GetHomeOutputDirectory() const;
/**
* Set CMAKE_SCRIPT_MODE_FILE variable when running a -P script.
*/
- void SetScriptModeFile(const char* scriptfile);
+ void SetScriptModeFile(std::string const& scriptfile);
/**
* Set CMAKE_ARGC, CMAKE_ARGV0 ... variables.
@@ -473,7 +473,7 @@ public:
/**
* Make sure CMake can write this file
*/
- bool CanIWriteThisFile(const char* fileName) const;
+ bool CanIWriteThisFile(std::string const& fileName) const;
#if defined(CMAKE_BUILD_WITH_CMAKE)
/**
@@ -878,8 +878,9 @@ protected:
std::string DefineFlags;
// Track the value of the computed DEFINITIONS property.
- void AddDefineFlag(const char*, std::string&);
- void RemoveDefineFlag(const char*, std::string::size_type, std::string&);
+ void AddDefineFlag(std::string const& flag, std::string&);
+ void RemoveDefineFlag(std::string const& flag, std::string::size_type,
+ std::string&);
std::string DefineFlagsOrig;
#if defined(CMAKE_BUILD_WITH_CMAKE)
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index ebc771b..9bbc043 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -326,28 +326,28 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
outpath = this->Makefile->GetCurrentBinaryDirectory();
outpath += cmake::GetCMakeFilesDirectory();
outpath += "/CMakeRelink.dir";
- cmSystemTools::MakeDirectory(outpath.c_str());
+ cmSystemTools::MakeDirectory(outpath);
outpath += "/";
if (!targetNameImport.empty()) {
outpathImp = outpath;
}
} else {
- cmSystemTools::MakeDirectory(outpath.c_str());
+ cmSystemTools::MakeDirectory(outpath);
if (!targetNameImport.empty()) {
outpathImp = this->GeneratorTarget->GetDirectory(
this->ConfigName, cmStateEnums::ImportLibraryArtifact);
- cmSystemTools::MakeDirectory(outpathImp.c_str());
+ cmSystemTools::MakeDirectory(outpathImp);
outpathImp += "/";
}
}
std::string compilePdbOutputPath =
this->GeneratorTarget->GetCompilePDBDirectory(this->ConfigName);
- cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str());
+ cmSystemTools::MakeDirectory(compilePdbOutputPath);
std::string pdbOutputPath =
this->GeneratorTarget->GetPDBDirectory(this->ConfigName);
- cmSystemTools::MakeDirectory(pdbOutputPath.c_str());
+ cmSystemTools::MakeDirectory(pdbOutputPath);
pdbOutputPath += "/";
std::string targetFullPath = outpath + targetName;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index cb99b3e..9299ffe 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -525,30 +525,30 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
outpath = this->Makefile->GetCurrentBinaryDirectory();
outpath += cmake::GetCMakeFilesDirectory();
outpath += "/CMakeRelink.dir";
- cmSystemTools::MakeDirectory(outpath.c_str());
+ cmSystemTools::MakeDirectory(outpath);
outpath += "/";
if (!targetNameImport.empty()) {
outpathImp = outpath;
}
} else {
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
- cmSystemTools::MakeDirectory(outpath.c_str());
+ cmSystemTools::MakeDirectory(outpath);
outpath += "/";
if (!targetNameImport.empty()) {
outpathImp = this->GeneratorTarget->GetDirectory(
this->ConfigName, cmStateEnums::ImportLibraryArtifact);
- cmSystemTools::MakeDirectory(outpathImp.c_str());
+ cmSystemTools::MakeDirectory(outpathImp);
outpathImp += "/";
}
}
std::string compilePdbOutputPath =
this->GeneratorTarget->GetCompilePDBDirectory(this->ConfigName);
- cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str());
+ cmSystemTools::MakeDirectory(compilePdbOutputPath);
std::string pdbOutputPath =
this->GeneratorTarget->GetPDBDirectory(this->ConfigName);
- cmSystemTools::MakeDirectory(pdbOutputPath.c_str());
+ cmSystemTools::MakeDirectory(pdbOutputPath);
pdbOutputPath += "/";
std::string targetFullPath = outpath + targetName;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index fc39365..73cf1f0 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -89,7 +89,7 @@ void cmMakefileTargetGenerator::CreateRuleFile()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->TargetBuildDirectoryFull =
this->LocalGenerator->ConvertToFullPath(this->TargetBuildDirectory);
- cmSystemTools::MakeDirectory(this->TargetBuildDirectoryFull.c_str());
+ cmSystemTools::MakeDirectory(this->TargetBuildDirectoryFull);
// Construct the rule file name.
this->BuildFileName = this->TargetBuildDirectory;
@@ -200,10 +200,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< "# Include any dependencies generated for this target.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator
- ->MaybeConvertToRelativePath(
- this->LocalGenerator->GetBinaryDirectory(), dependFileNameFull)
- .c_str())
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(), dependFileNameFull))
<< "\n\n";
if (!this->NoRuleMessages) {
@@ -212,16 +210,14 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< "# Include the progress variables for this target.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator
- ->MaybeConvertToRelativePath(
- this->LocalGenerator->GetBinaryDirectory(),
- this->ProgressFileNameFull)
- .c_str())
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(),
+ this->ProgressFileNameFull))
<< "\n\n";
}
// make sure the depend file exists
- if (!cmSystemTools::FileExists(dependFileNameFull.c_str())) {
+ if (!cmSystemTools::FileExists(dependFileNameFull)) {
// Write an empty dependency file.
cmGeneratedFileStream depFileStream(
dependFileNameFull.c_str(), false,
@@ -250,11 +246,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< "# Include the compile flags for this target's objects.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator
- ->MaybeConvertToRelativePath(
- this->LocalGenerator->GetBinaryDirectory(),
- this->FlagFileNameFull)
- .c_str())
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(), this->FlagFileNameFull))
<< "\n\n";
}
@@ -368,8 +361,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// Create the directory containing the object file. This may be a
// subdirectory under the target's directory.
std::string dir = cmSystemTools::GetFilenamePath(obj);
- cmSystemTools::MakeDirectory(
- this->LocalGenerator->ConvertToFullPath(dir).c_str());
+ cmSystemTools::MakeDirectory(this->LocalGenerator->ConvertToFullPath(dir));
// Save this in the target's list of object files.
this->Objects.push_back(obj);
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index dbc0bc6..8fbd5d2 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -46,11 +46,9 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
<< "# Include the progress variables for this target.\n"
<< this->GlobalGenerator->IncludeDirective << " " << root
<< cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator
- ->MaybeConvertToRelativePath(
- this->LocalGenerator->GetBinaryDirectory(),
- this->ProgressFileNameFull)
- .c_str())
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(),
+ this->ProgressFileNameFull))
<< "\n\n";
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 3f0c42e..f4faf47 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1083,7 +1083,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
std::string escapedSourceFileName = sourceFileName;
- if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(sourceFileName)) {
escapedSourceFileName = cmSystemTools::CollapseFullPath(
escapedSourceFileName, this->GetGlobalGenerator()
->GetCMakeInstance()
@@ -1143,8 +1143,8 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
void cmNinjaTargetGenerator::EnsureDirectoryExists(
const std::string& path) const
{
- if (cmSystemTools::FileIsFullPath(path.c_str())) {
- cmSystemTools::MakeDirectory(path.c_str());
+ if (cmSystemTools::FileIsFullPath(path)) {
+ cmSystemTools::MakeDirectory(path);
} else {
cmGlobalNinjaGenerator* gg = this->GetGlobalGenerator();
std::string fullPath =
@@ -1152,7 +1152,7 @@ void cmNinjaTargetGenerator::EnsureDirectoryExists(
// Also ensures their is a trailing slash.
gg->StripNinjaOutputPathPrefixAsSuffix(fullPath);
fullPath += path;
- cmSystemTools::MakeDirectory(fullPath.c_str());
+ cmSystemTools::MakeDirectory(fullPath);
}
}
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index e658e2c..2b96785 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -43,7 +43,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
out += "/";
out += this->GT->GetAppBundleDirectory(this->ConfigName,
cmGeneratorTarget::FullLevel);
- cmSystemTools::MakeDirectory(out.c_str());
+ cmSystemTools::MakeDirectory(out);
this->Makefile->AddCMakeOutputFile(out);
// Configure the Info.plist file. Note that it needs the executable name
@@ -105,10 +105,10 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName,
// Make foo.framework/Versions
std::string versions = contentdir;
versions += "Versions";
- cmSystemTools::MakeDirectory(versions.c_str());
+ cmSystemTools::MakeDirectory(versions);
// Make foo.framework/Versions/version
- cmSystemTools::MakeDirectory(newoutpath.c_str());
+ cmSystemTools::MakeDirectory(newoutpath);
// Current -> version
oldName = frameworkVersion;
@@ -173,7 +173,7 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
out += "/";
out += this->GT->GetCFBundleDirectory(this->ConfigName,
cmGeneratorTarget::FullLevel);
- cmSystemTools::MakeDirectory(out.c_str());
+ cmSystemTools::MakeDirectory(out);
this->Makefile->AddCMakeOutputFile(out);
// Configure the Info.plist file. Note that it needs the executable name
@@ -213,7 +213,7 @@ std::string cmOSXBundleGenerator::InitMacOSXContentDirectory(
this->ConfigName, cmStateEnums::RuntimeBinaryArtifact);
macdir += "/";
macdir += pkgloc;
- cmSystemTools::MakeDirectory(macdir.c_str());
+ cmSystemTools::MakeDirectory(macdir);
// Record use of this content location. Only the first level
// directory is needed.
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 27ad710..04a9318 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -118,7 +118,7 @@ bool cmOrderDirectoriesConstraint::FileMayConflict(std::string const& dir,
std::string file = dir;
file += "/";
file += name;
- if (cmSystemTools::FileExists(file.c_str(), true)) {
+ if (cmSystemTools::FileExists(file, true)) {
// The file conflicts only if it is not the same as the original
// file due to a symlink or hardlink.
return !cmSystemTools::SameFile(this->FullPath, file);
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index dac6569..25db929 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -29,7 +29,7 @@ std::string cmOutputConverter::ConvertToOutputForExisting(
// space.
if (this->GetState()->UseWindowsShell() &&
remote.find(' ') != std::string::npos &&
- cmSystemTools::FileExists(remote.c_str())) {
+ cmSystemTools::FileExists(remote)) {
std::string tmp;
if (cmSystemTools::GetShortPath(remote, tmp)) {
return this->ConvertToOutputFormat(tmp, format);
@@ -125,7 +125,7 @@ std::string cmOutputConverter::ForceToRelativePath(
assert(local_path.empty() || local_path[local_path.size() - 1] != '/');
// If the path is already relative then just return the path.
- if (!cmSystemTools::FileIsFullPath(remote_path.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(remote_path)) {
return remote_path;
}
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index cde9037..bdb98ca 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -173,7 +173,7 @@ protected:
std::string line;
while (cmSystemTools::GetLineFromStream(fin, line)) {
- if (cmHasLiteralPrefix(line.c_str(), "#include")) {
+ if (cmHasLiteralPrefix(line, "#include")) {
// if it is an include line then create a string class
size_t qstart = line.find('\"', 8);
size_t qend;
@@ -213,51 +213,51 @@ protected:
cxxFile = root + ".cxx";
bool found = false;
// try jumping to .cxx .cpp and .c in order
- if (cmSystemTools::FileExists(cxxFile.c_str())) {
+ if (cmSystemTools::FileExists(cxxFile)) {
found = true;
}
for (std::string path : this->IncludeDirectories) {
path = path + "/";
path = path + cxxFile;
- if (cmSystemTools::FileExists(path.c_str())) {
+ if (cmSystemTools::FileExists(path)) {
found = true;
}
}
if (!found) {
cxxFile = root + ".cpp";
- if (cmSystemTools::FileExists(cxxFile.c_str())) {
+ if (cmSystemTools::FileExists(cxxFile)) {
found = true;
}
for (std::string path : this->IncludeDirectories) {
path = path + "/";
path = path + cxxFile;
- if (cmSystemTools::FileExists(path.c_str())) {
+ if (cmSystemTools::FileExists(path)) {
found = true;
}
}
}
if (!found) {
cxxFile = root + ".c";
- if (cmSystemTools::FileExists(cxxFile.c_str())) {
+ if (cmSystemTools::FileExists(cxxFile)) {
found = true;
}
for (std::string path : this->IncludeDirectories) {
path = path + "/";
path = path + cxxFile;
- if (cmSystemTools::FileExists(path.c_str())) {
+ if (cmSystemTools::FileExists(path)) {
found = true;
}
}
}
if (!found) {
cxxFile = root + ".txx";
- if (cmSystemTools::FileExists(cxxFile.c_str())) {
+ if (cmSystemTools::FileExists(cxxFile)) {
found = true;
}
for (std::string path : this->IncludeDirectories) {
path = path + "/";
path = path + cxxFile;
- if (cmSystemTools::FileExists(path.c_str())) {
+ if (cmSystemTools::FileExists(path)) {
found = true;
}
}
@@ -426,7 +426,7 @@ protected:
path = path + "/";
}
path = path + fname;
- if (cmSystemTools::FileExists(path.c_str(), true) &&
+ if (cmSystemTools::FileExists(path, true) &&
!cmSystemTools::FileIsDirectory(path)) {
std::string fp = cmSystemTools::CollapseFullPath(path);
this->DirectoryToFileToPathMap[extraPath ? extraPath : ""][fname] = fp;
@@ -440,7 +440,7 @@ protected:
path = path + "/";
}
path = path + fname;
- if (cmSystemTools::FileExists(path.c_str(), true) &&
+ if (cmSystemTools::FileExists(path, true) &&
!cmSystemTools::FileIsDirectory(path)) {
std::string fp = cmSystemTools::CollapseFullPath(path);
this->DirectoryToFileToPathMap[extraPath][fname] = fp;
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 923d5ab..09cc63a 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -47,7 +47,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
// Compute the name of the header from which to generate the file.
std::string hname;
- if (cmSystemTools::FileIsFullPath(j->c_str())) {
+ if (cmSystemTools::FileIsFullPath(*j)) {
hname = *j;
} else {
if (curr && curr->GetPropertyAsBool("GENERATED")) {
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index bbd80f9..da36cdf 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -55,7 +55,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
// Compute the name of the ui file from which to generate others.
std::string uiName;
- if (cmSystemTools::FileIsFullPath(j->c_str())) {
+ if (cmSystemTools::FileIsFullPath(*j)) {
uiName = *j;
} else {
if (curr && curr->GetPropertyAsBool("GENERATED")) {
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index d845e8b..0f3cb23 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -169,9 +169,9 @@ static std::string FileProjectRelativePath(cmMakefile* makefile,
std::string res;
{
std::string pSource = cmSystemTools::RelativePath(
- makefile->GetCurrentSourceDirectory(), fileName.c_str());
+ makefile->GetCurrentSourceDirectory(), fileName);
std::string pBinary = cmSystemTools::RelativePath(
- makefile->GetCurrentBinaryDirectory(), fileName.c_str());
+ makefile->GetCurrentBinaryDirectory(), fileName);
if (pSource.size() < pBinary.size()) {
res = std::move(pSource);
} else if (pBinary.size() < fileName.size()) {
@@ -1387,7 +1387,7 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName,
std::vector<std::string>& files,
std::string& error)
{
- if (!cmSystemTools::FileExists(fileName.c_str())) {
+ if (!cmSystemTools::FileExists(fileName)) {
error = "rcc resource file does not exist:\n ";
error += Quoted(fileName);
error += "\n";
diff --git a/Source/cmRemoveDefinitionsCommand.cxx b/Source/cmRemoveDefinitionsCommand.cxx
index 8311b4b..8d3f688 100644
--- a/Source/cmRemoveDefinitionsCommand.cxx
+++ b/Source/cmRemoveDefinitionsCommand.cxx
@@ -16,7 +16,7 @@ bool cmRemoveDefinitionsCommand::InitialPass(
}
for (std::string const& i : args) {
- this->Makefile->RemoveDefineFlag(i.c_str());
+ this->Makefile->RemoveDefineFlag(i);
}
return true;
}
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index df68d04..fbfaa40 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -103,7 +103,7 @@ void getCMakeInputs(const cmGlobalGenerator* gg, const std::string& sourceDir,
std::string toAdd = lf;
if (!sourceDir.empty()) {
const std::string& relative =
- cmSystemTools::RelativePath(sourceDir.c_str(), lf.c_str());
+ cmSystemTools::RelativePath(sourceDir, lf);
if (toAdd.size() > relative.size()) {
toAdd = relative;
}
@@ -548,8 +548,8 @@ cmServerResponse cmServerProtocol1::ProcessCMakeInputs(
const cmake* cm = this->CMakeInstance();
const cmGlobalGenerator* gg = cm->GetGlobalGenerator();
const std::string cmakeRootDir = cmSystemTools::GetCMakeRoot();
- const std::string buildDir = cm->GetHomeOutputDirectory();
- const std::string sourceDir = cm->GetHomeDirectory();
+ const std::string& buildDir = cm->GetHomeOutputDirectory();
+ const std::string& sourceDir = cm->GetHomeDirectory();
Json::Value result = Json::objectValue;
result[kSOURCE_DIRECTORY_KEY] = sourceDir;
@@ -675,8 +675,7 @@ static Json::Value DumpSourceFileGroup(const LanguageData& data,
Json::Value sourcesValue = Json::arrayValue;
for (auto const& i : files) {
- const std::string relPath =
- cmSystemTools::RelativePath(baseDir.c_str(), i.c_str());
+ const std::string relPath = cmSystemTools::RelativePath(baseDir, i);
sourcesValue.append(relPath.size() < i.size() ? relPath : i);
}
@@ -922,7 +921,7 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
auto dest = installTargetGenerator->GetDestination(config);
std::string installPath;
- if (!dest.empty() && cmSystemTools::FileIsFullPath(dest.c_str())) {
+ if (!dest.empty() && cmSystemTools::FileIsFullPath(dest)) {
installPath = dest;
} else {
std::string installPrefix =
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 7efcc04..171b62e 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -167,7 +167,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
// Construct the directory name. Interpret relative paths with
// respect to the current directory.
std::string dir = *this->Names.begin();
- if (!cmSystemTools::FileIsFullPath(dir.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(dir)) {
dir = this->Makefile->GetCurrentSourceDirectory();
dir += "/";
dir += *this->Names.begin();
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 215f974..6792d66 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -192,7 +192,7 @@ bool cmSourceFile::TryFullPath(const std::string& path, const std::string& ext)
tryPath += ".";
tryPath += ext;
}
- if (cmSystemTools::FileExists(tryPath.c_str())) {
+ if (cmSystemTools::FileExists(tryPath)) {
this->FullPath = tryPath;
return true;
}
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 5558ef3..bd8d318 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -31,10 +31,10 @@ cmSourceFileLocation::cmSourceFileLocation(cmMakefile const* mf,
cmSourceFileLocationKind kind)
: Makefile(mf)
{
- this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name.c_str());
+ this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name);
this->AmbiguousExtension = true;
this->Directory = cmSystemTools::GetFilenamePath(name);
- if (cmSystemTools::FileIsFullPath(this->Directory.c_str())) {
+ if (cmSystemTools::FileIsFullPath(this->Directory)) {
this->Directory = cmSystemTools::CollapseFullPath(this->Directory);
}
this->Name = cmSystemTools::GetFilenameName(name);
@@ -112,7 +112,7 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name)
tryPath += "/";
}
tryPath += this->Name;
- if (cmSystemTools::FileExists(tryPath.c_str(), true)) {
+ if (cmSystemTools::FileExists(tryPath, true)) {
// We found a source file named by the user on disk. Trust it's
// extension.
this->Name = cmSystemTools::GetFilenameName(name);
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 87ecc56..8c9b63c 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -28,7 +28,7 @@ std::string getFullFilePath(const std::string& currentPath,
{
std::string fullPath = path;
- if (!cmSystemTools::FileIsFullPath(path.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(path)) {
fullPath = currentPath;
fullPath += "/";
fullPath += path;
@@ -234,7 +234,7 @@ bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args,
parsedArguments[kFilesOptionName];
for (auto const& filesArg : filesArguments) {
std::string src = filesArg;
- if (!cmSystemTools::FileIsFullPath(src.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(src)) {
src = this->Makefile->GetCurrentSourceDirectory();
src += "/";
src += filesArg;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 00d7e9a..bb891b5 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -93,7 +93,7 @@ cmStateEnums::CacheEntryType cmState::StringToCacheEntryType(const char* s)
bool cmState::IsCacheEntryType(std::string const& key)
{
for (int i = 0; cmCacheEntryTypes[i]; ++i) {
- if (strcmp(key.c_str(), cmCacheEntryTypes[i]) == 0) {
+ if (key == cmCacheEntryTypes[i]) {
return true;
}
}
@@ -514,9 +514,9 @@ void cmState::SetSourceDirectory(std::string const& sourceDirectory)
cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory);
}
-const char* cmState::GetSourceDirectory() const
+std::string const& cmState::GetSourceDirectory() const
{
- return this->SourceDirectory.c_str();
+ return this->SourceDirectory;
}
void cmState::SetBinaryDirectory(std::string const& binaryDirectory)
@@ -595,9 +595,9 @@ unsigned int cmState::GetCacheMinorVersion() const
return this->CacheManager->GetCacheMinorVersion();
}
-const char* cmState::GetBinaryDirectory() const
+std::string const& cmState::GetBinaryDirectory() const
{
- return this->BinaryDirectory.c_str();
+ return this->BinaryDirectory;
}
cmStateSnapshot cmState::CreateBaseSnapshot()
diff --git a/Source/cmState.h b/Source/cmState.h
index 7282f0a..6cbf82d 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -138,9 +138,9 @@ public:
const char* GetGlobalProperty(const std::string& prop);
bool GetGlobalPropertyAsBool(const std::string& prop);
- const char* GetSourceDirectory() const;
+ std::string const& GetSourceDirectory() const;
void SetSourceDirectory(std::string const& sourceDirectory);
- const char* GetBinaryDirectory() const;
+ std::string const& GetBinaryDirectory() const;
void SetBinaryDirectory(std::string const& binaryDirectory);
void SetWindowsShell(bool windowsShell);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 5b6d3c3..88cfe81 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -877,7 +877,7 @@ bool cmSystemTools::DoesFileExistWithExtensions(
hname = name;
hname += ".";
hname += headerExt;
- if (cmSystemTools::FileExists(hname.c_str())) {
+ if (cmSystemTools::FileExists(hname)) {
return true;
}
}
@@ -895,7 +895,7 @@ std::string cmSystemTools::FileExistsInParentDirectories(const char* fname,
std::string prevDir;
while (dir != prevDir) {
std::string path = dir + "/" + file;
- if (cmSystemTools::FileExists(path.c_str())) {
+ if (cmSystemTools::FileExists(path)) {
return path;
}
if (dir.size() < strlen(toplevel)) {
@@ -1371,7 +1371,7 @@ bool cmSystemTools::Split(const char* s, std::vector<std::string>& l)
return res;
}
-std::string cmSystemTools::ConvertToOutputPath(const char* path)
+std::string cmSystemTools::ConvertToOutputPath(std::string const& path)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
if (s_ForceUnixPaths) {
@@ -1408,15 +1408,16 @@ std::string cmSystemTools::ConvertToRunCommandPath(const char* path)
}
// compute the relative path from here to there
-std::string cmSystemTools::RelativePath(const char* local, const char* remote)
+std::string cmSystemTools::RelativePath(std::string const& local,
+ std::string const& remote)
{
if (!cmSystemTools::FileIsFullPath(local)) {
cmSystemTools::Error("RelativePath must be passed a full path to local: ",
- local);
+ local.c_str());
}
if (!cmSystemTools::FileIsFullPath(remote)) {
cmSystemTools::Error("RelativePath must be passed a full path to remote: ",
- remote);
+ remote.c_str());
}
return cmsys::SystemTools::RelativePath(local, remote);
}
@@ -1570,9 +1571,9 @@ bool cmSystemTools::CreateTar(const char* outFileName,
a.SetMTime(mtime);
a.SetVerbose(verbose);
for (auto path : files) {
- if (cmSystemTools::FileIsFullPath(path.c_str())) {
+ if (cmSystemTools::FileIsFullPath(path)) {
// Get the relative path to the file.
- path = cmSystemTools::RelativePath(cwd.c_str(), path.c_str());
+ path = cmSystemTools::RelativePath(cwd, path);
}
if (!a.Add(path)) {
break;
@@ -2177,19 +2178,19 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
cmSystemToolsCMakeGUICommand = exe_dir;
cmSystemToolsCMakeGUICommand += "/cmake-gui";
cmSystemToolsCMakeGUICommand += cmSystemTools::GetExecutableExtension();
- if (!cmSystemTools::FileExists(cmSystemToolsCMakeGUICommand.c_str())) {
+ if (!cmSystemTools::FileExists(cmSystemToolsCMakeGUICommand)) {
cmSystemToolsCMakeGUICommand.clear();
}
cmSystemToolsCMakeCursesCommand = exe_dir;
cmSystemToolsCMakeCursesCommand += "/ccmake";
cmSystemToolsCMakeCursesCommand += cmSystemTools::GetExecutableExtension();
- if (!cmSystemTools::FileExists(cmSystemToolsCMakeCursesCommand.c_str())) {
+ if (!cmSystemTools::FileExists(cmSystemToolsCMakeCursesCommand)) {
cmSystemToolsCMakeCursesCommand.clear();
}
cmSystemToolsCMClDepsCommand = exe_dir;
cmSystemToolsCMClDepsCommand += "/cmcldeps";
cmSystemToolsCMClDepsCommand += cmSystemTools::GetExecutableExtension();
- if (!cmSystemTools::FileExists(cmSystemToolsCMClDepsCommand.c_str())) {
+ if (!cmSystemTools::FileExists(cmSystemToolsCMClDepsCommand)) {
cmSystemToolsCMClDepsCommand.clear();
}
@@ -2204,7 +2205,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
}
if (cmSystemToolsCMakeRoot.empty() ||
!cmSystemTools::FileExists(
- (cmSystemToolsCMakeRoot + "/Modules/CMake.cmake").c_str())) {
+ (cmSystemToolsCMakeRoot + "/Modules/CMake.cmake"))) {
// Build tree has "<build>/bin[/<config>]/cmake" and
// "<build>/CMakeFiles/CMakeSourceDir.txt".
std::string dir = cmSystemTools::GetFilenamePath(exe_dir);
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index d1e07c5..a53afde 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -354,7 +354,7 @@ public:
static bool GetForceUnixPaths() { return s_ForceUnixPaths; }
// ConvertToOutputPath use s_ForceUnixPaths
- static std::string ConvertToOutputPath(const char* path);
+ static std::string ConvertToOutputPath(std::string const& path);
static void ConvertToOutputSlashes(std::string& path);
// ConvertToRunCommandPath does not use s_ForceUnixPaths and should
@@ -370,7 +370,8 @@ public:
/a/b/c/d to /a/b/c1/d1 -> ../../c1/d1
from /usr/src to /usr/src/test/blah/foo.cpp -> test/blah/foo.cpp
*/
- static std::string RelativePath(const char* local, const char* remote);
+ static std::string RelativePath(std::string const& local,
+ std::string const& remote);
/** Joins two paths while collapsing x/../ parts
* For example CollapseCombinedPath("a/b/c", "../../d") results in "a/d"
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index bd4121d..4e716dc 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -33,7 +33,7 @@ std::string cmTargetCompileDefinitionsCommand::Join(
std::string defs;
std::string sep;
for (std::string const& it : content) {
- if (cmHasLiteralPrefix(it.c_str(), "-D")) {
+ if (cmHasLiteralPrefix(it, "-D")) {
defs += sep + it.substr(2);
} else {
defs += sep + it;
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index dcec830..fc546cc 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -38,7 +38,7 @@ std::string cmTargetIncludeDirectoriesCommand::Join(
std::string prefix =
this->Makefile->GetCurrentSourceDirectory() + std::string("/");
for (std::string const& it : content) {
- if (cmSystemTools::FileIsFullPath(it.c_str()) ||
+ if (cmSystemTools::FileIsFullPath(it) ||
cmGeneratorExpression::Find(it) == 0) {
dirs += sep + it;
} else {
@@ -60,7 +60,7 @@ bool cmTargetIncludeDirectoriesCommand::HandleDirectContent(
this->Makefile->GetCurrentSourceDirectory() + std::string("/");
std::set<std::string> sdirs;
for (std::string const& it : content) {
- if (cmSystemTools::FileIsFullPath(it.c_str()) ||
+ if (cmSystemTools::FileIsFullPath(it) ||
cmGeneratorExpression::Find(it) == 0) {
sdirs.insert(it);
} else {
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index b6bfbfa..3ff84ce 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -28,7 +28,7 @@ bool cmTryCompileCommand::InitialPass(std::vector<std::string> const& argv,
// if They specified clean then we clean up what we can
if (this->SrcFileSignature) {
if (!this->Makefile->GetCMakeInstance()->GetDebugTryCompile()) {
- this->CleanupFiles(this->BinaryDirectory.c_str());
+ this->CleanupFiles(this->BinaryDirectory);
}
}
return true;
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 94edf93..9396138 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -153,7 +153,7 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
// if we created a directory etc, then cleanup after ourselves
if (!this->Makefile->GetCMakeInstance()->GetDebugTryCompile()) {
- this->CleanupFiles(this->BinaryDirectory.c_str());
+ this->CleanupFiles(this->BinaryDirectory);
}
return true;
}
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index 8d4b018..ea012f6 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -23,7 +23,7 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args,
std::string glh = inputDir;
glh += "/";
glh += "gl.h";
- if (!cmSystemTools::FileExists(glh.c_str())) {
+ if (!cmSystemTools::FileExists(glh)) {
std::string e = "Bad path to Mesa, could not find: ";
e += glh;
e += " ";
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index 0ce437c..1140800 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -66,14 +66,14 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
utilitySource = utilitySource + "/" + relativeSource;
// If the directory doesn't exist, the source has not been included.
- if (!cmSystemTools::FileExists(utilitySource.c_str())) {
+ if (!cmSystemTools::FileExists(utilitySource)) {
return true;
}
// Make sure all the files exist in the source directory.
while (arg != args.end()) {
std::string file = utilitySource + "/" + *arg++;
- if (!cmSystemTools::FileExists(file.c_str())) {
+ if (!cmSystemTools::FileExists(file)) {
return true;
}
}
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx
index fc5fd21..3464a1b 100644
--- a/Source/cmWriteFileCommand.cxx
+++ b/Source/cmWriteFileCommand.cxx
@@ -33,7 +33,7 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args,
}
}
- if (!this->Makefile->CanIWriteThisFile(fileName.c_str())) {
+ if (!this->Makefile->CanIWriteThisFile(fileName)) {
std::string e =
"attempted to write a file: " + fileName + " into a source directory.";
this->SetError(e);
@@ -42,7 +42,7 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args,
}
std::string dir = cmSystemTools::GetFilenamePath(fileName);
- cmSystemTools::MakeDirectory(dir.c_str());
+ cmSystemTools::MakeDirectory(dir);
mode_t mode = 0;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 39beb9f..5620723 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -487,7 +487,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
if (this->GetWorkingMode() != NORMAL_MODE) {
std::string file(cmSystemTools::CollapseFullPath(path));
cmSystemTools::ConvertToUnixSlashes(file);
- mf.SetScriptModeFile(file.c_str());
+ mf.SetScriptModeFile(file);
mf.SetArgcArgv(args);
}
@@ -783,10 +783,10 @@ void cmake::SetDirectoriesFromFile(const char* arg)
cacheFile += "/CMakeCache.txt";
std::string listFile = path;
listFile += "/CMakeLists.txt";
- if (cmSystemTools::FileExists(cacheFile.c_str())) {
+ if (cmSystemTools::FileExists(cacheFile)) {
cachePath = path;
}
- if (cmSystemTools::FileExists(listFile.c_str())) {
+ if (cmSystemTools::FileExists(listFile)) {
listPath = path;
}
} else if (cmSystemTools::FileExists(arg)) {
@@ -869,7 +869,7 @@ int cmake::AddCMakePaths()
"Path to cpack program executable.", cmStateEnums::INTERNAL);
#endif
if (!cmSystemTools::FileExists(
- (cmSystemTools::GetCMakeRoot() + "/Modules/CMake.cmake").c_str())) {
+ (cmSystemTools::GetCMakeRoot() + "/Modules/CMake.cmake"))) {
// couldn't find modules
cmSystemTools::Error(
"Could not find CMAKE_ROOT !!!\n"
@@ -1003,7 +1003,7 @@ void cmake::SetHomeDirectory(const std::string& dir)
}
}
-const char* cmake::GetHomeDirectory() const
+std::string const& cmake::GetHomeDirectory() const
{
return this->State->GetSourceDirectory();
}
@@ -1016,7 +1016,7 @@ void cmake::SetHomeOutputDirectory(const std::string& dir)
}
}
-const char* cmake::GetHomeOutputDirectory() const
+std::string const& cmake::GetHomeOutputDirectory() const
{
return this->State->GetBinaryDirectory();
}
@@ -1027,11 +1027,11 @@ std::string cmake::FindCacheFile(const std::string& binaryDir)
cmSystemTools::ConvertToUnixSlashes(cachePath);
std::string cacheFile = cachePath;
cacheFile += "/CMakeCache.txt";
- if (!cmSystemTools::FileExists(cacheFile.c_str())) {
+ if (!cmSystemTools::FileExists(cacheFile)) {
// search in parent directories for cache
std::string cmakeFiles = cachePath;
cmakeFiles += "/CMakeFiles";
- if (cmSystemTools::FileExists(cmakeFiles.c_str())) {
+ if (cmSystemTools::FileExists(cmakeFiles)) {
std::string cachePathFound =
cmSystemTools::FileExistsInParentDirectories("CMakeCache.txt",
cachePath.c_str(), "/");
@@ -1087,7 +1087,7 @@ int cmake::DoPreConfigureChecks()
// Make sure the Source directory contains a CMakeLists.txt file.
std::string srcList = this->GetHomeDirectory();
srcList += "/CMakeLists.txt";
- if (!cmSystemTools::FileExists(srcList.c_str())) {
+ if (!cmSystemTools::FileExists(srcList)) {
std::ostringstream err;
if (cmSystemTools::FileIsDirectory(this->GetHomeDirectory())) {
err << "The source directory \"" << this->GetHomeDirectory()
@@ -1272,7 +1272,7 @@ int cmake::ActualConfigure()
}
if (!res) {
this->AddCacheEntry(
- "CMAKE_HOME_DIRECTORY", this->GetHomeDirectory(),
+ "CMAKE_HOME_DIRECTORY", this->GetHomeDirectory().c_str(),
"Source directory with the top level CMakeLists.txt file for this "
"project",
cmStateEnums::INTERNAL);
@@ -1509,14 +1509,14 @@ void cmake::PreLoadCMakeFiles()
std::string pre_load = this->GetHomeDirectory();
if (!pre_load.empty()) {
pre_load += "/PreLoad.cmake";
- if (cmSystemTools::FileExists(pre_load.c_str())) {
+ if (cmSystemTools::FileExists(pre_load)) {
this->ReadListFile(args, pre_load.c_str());
}
}
pre_load = this->GetHomeOutputDirectory();
if (!pre_load.empty()) {
pre_load += "/PreLoad.cmake";
- if (cmSystemTools::FileExists(pre_load.c_str())) {
+ if (cmSystemTools::FileExists(pre_load)) {
this->ReadListFile(args, pre_load.c_str());
}
}
@@ -1724,7 +1724,7 @@ int cmake::LoadCache()
// if it does exist, but isn't readable then warn the user
std::string cacheFile = this->GetHomeOutputDirectory();
cacheFile += "/CMakeCache.txt";
- if (cmSystemTools::FileExists(cacheFile.c_str())) {
+ if (cmSystemTools::FileExists(cacheFile)) {
cmSystemTools::Error(
"There is a CMakeCache.txt file for the current binary tree but "
"cmake does not have permission to read it. Please check the "
@@ -1891,7 +1891,7 @@ int cmake::CheckBuildSystem()
}
// If the file provided does not exist, we have to rerun.
- if (!cmSystemTools::FileExists(this->CheckBuildSystemArgument.c_str())) {
+ if (!cmSystemTools::FileExists(this->CheckBuildSystemArgument)) {
if (verbose) {
std::ostringstream msg;
msg << "Re-run cmake missing file: " << this->CheckBuildSystemArgument
@@ -1945,8 +1945,7 @@ int cmake::CheckBuildSystem()
cmSystemTools::ExpandListArgument(productStr, products);
}
for (std::string const& p : products) {
- if (!(cmSystemTools::FileExists(p.c_str()) ||
- cmSystemTools::FileIsSymlink(p))) {
+ if (!(cmSystemTools::FileExists(p) || cmSystemTools::FileIsSymlink(p))) {
if (verbose) {
std::ostringstream msg;
msg << "Re-run cmake, missing byproduct: " << p << "\n";
@@ -2144,7 +2143,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
std::string destPath = cwd + "/__cmake_systeminformation";
cmSystemTools::RemoveADirectory(destPath);
- if (!cmSystemTools::MakeDirectory(destPath.c_str())) {
+ if (!cmSystemTools::MakeDirectory(destPath)) {
std::cerr << "Error: --system-information must be run from a "
"writable directory!\n";
return 1;
@@ -2176,7 +2175,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
}
// no option assume it is the output file
else {
- if (!cmSystemTools::FileIsFullPath(arg.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(arg)) {
resultFile = cwd;
resultFile += "/";
}
@@ -2429,7 +2428,7 @@ int cmake::Build(const std::string& dir, const std::string& target,
cmGlobalVisualStudio8Generator::GetGenerateStampList();
// Note that the stampList file only exists for VS generators.
- if (cmSystemTools::FileExists(stampList.c_str()) &&
+ if (cmSystemTools::FileExists(stampList) &&
!cmakeCheckStampList(stampList.c_str(), false)) {
// Correctly initialize the home (=source) and home output (=binary)
diff --git a/Source/cmake.h b/Source/cmake.h
index 02c6cdb..1ac549b 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -142,9 +142,9 @@ public:
* path-to-source cmake was run with.
*/
void SetHomeDirectory(const std::string& dir);
- const char* GetHomeDirectory() const;
+ std::string const& GetHomeDirectory() const;
void SetHomeOutputDirectory(const std::string& dir);
- const char* GetHomeOutputDirectory() const;
+ std::string const& GetHomeOutputDirectory() const;
//@}
/**
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 70e4fde..0988c3c 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -641,7 +641,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// If error occurs we want to continue copying next files.
bool return_value = false;
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
- if (!cmSystemTools::MakeDirectory(args[cc].c_str())) {
+ if (!cmSystemTools::MakeDirectory(args[cc])) {
std::cerr << "Error creating directory \"" << args[cc] << "\".\n";
return_value = true;
}
@@ -668,7 +668,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Complain if the file could not be removed, still exists,
// and the -f option was not given.
if (!cmSystemTools::RemoveFile(args[cc]) && !force &&
- cmSystemTools::FileExists(args[cc].c_str())) {
+ cmSystemTools::FileExists(args[cc])) {
return 1;
}
}
@@ -789,7 +789,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Command to change directory and run a program.
if (args[1] == "chdir" && args.size() >= 4) {
std::string const& directory = args[2];
- if (!cmSystemTools::FileExists(directory.c_str())) {
+ if (!cmSystemTools::FileExists(directory)) {
cmSystemTools::Error("Directory does not exist for chdir command: ",
args[2].c_str());
return 1;
@@ -826,7 +826,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
count = atoi(args[3].c_str());
}
if (count) {
- cmSystemTools::MakeDirectory(dirName.c_str());
+ cmSystemTools::MakeDirectory(dirName);
// write the count into the directory
std::string fName = dirName;
fName += "/count.txt";
@@ -1274,8 +1274,7 @@ int cmcmd::SymlinkExecutable(std::vector<std::string>& args)
bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link)
{
- if (cmSystemTools::FileExists(link.c_str()) ||
- cmSystemTools::FileIsSymlink(link)) {
+ if (cmSystemTools::FileExists(link) || cmSystemTools::FileIsSymlink(link)) {
cmSystemTools::RemoveFile(link);
}
#if defined(_WIN32) && !defined(__CYGWIN__)