diff options
28 files changed, 134 insertions, 154 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 63c2fcc..1c16a71 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -109,8 +109,8 @@ void cmCTestMultiProcessHandler::SetTestLoad(unsigned long load) fake_load_value)) { if (!cmSystemTools::StringToULong(fake_load_value.c_str(), &this->FakeLoadForTesting)) { - cmSystemTools::Error("Failed to parse fake load value: ", - fake_load_value.c_str()); + cmSystemTools::Error("Failed to parse fake load value: " + + fake_load_value); } } } diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index a714abe..43cfe16 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -331,7 +331,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) } // make sure the file exists if (!cmSystemTools::FileExists(script)) { - cmSystemTools::Error("Cannot find file: ", script.c_str()); + cmSystemTools::Error("Cannot find file: " + script); return 1; } @@ -471,8 +471,8 @@ int cmCTestScriptHandler::ExtractVariables() msg += "\nCTEST_COMMAND = "; msg += (!this->CTestCmd.empty()) ? this->CTestCmd.c_str() : "(Null)"; cmSystemTools::Error( - "Some required settings in the configuration file were missing:\n", - msg.c_str()); + "Some required settings in the configuration file were missing:\n" + + msg); return 4; } @@ -611,8 +611,7 @@ int cmCTestScriptHandler::CheckOutSourceDir() this->CVSCheckOut, &output, &output, &retVal, this->CTestRoot.c_str(), this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/); if (!res || retVal != 0) { - cmSystemTools::Error("Unable to perform cvs checkout:\n", - output.c_str()); + cmSystemTools::Error("Unable to perform cvs checkout:\n" + output); return 6; } } @@ -678,8 +677,8 @@ int cmCTestScriptHandler::PerformExtraUpdates() fullCommand, &output, &output, &retVal, cvsArgs[0].c_str(), this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/); if (!res || retVal != 0) { - cmSystemTools::Error("Unable to perform extra updates:\n", eu.c_str(), - "\nWith output:\n", output.c_str()); + cmSystemTools::Error("Unable to perform extra updates:\n" + eu + + "\nWith output:\n" + output); return 0; } } @@ -721,8 +720,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard() if (!cmSystemTools::FileExists(this->BinaryDir) && this->SourceDir != this->BinaryDir) { if (!cmSystemTools::MakeDirectory(this->BinaryDir)) { - cmSystemTools::Error("Unable to create the binary directory:\n", - this->BinaryDir.c_str()); + cmSystemTools::Error("Unable to create the binary directory:\n" + + this->BinaryDir); this->RestoreBackupDirectories(); return 7; } diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 2728f0f..6116de0 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -239,8 +239,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) cmGeneratedFileStream fout(cacheFile); fout.SetCopyIfDifferent(true); if (!fout) { - cmSystemTools::Error("Unable to open cache file for save. ", - cacheFile.c_str()); + cmSystemTools::Error("Unable to open cache file for save. " + cacheFile); cmSystemTools::ReportLastSystemError(""); return false; } @@ -364,8 +363,8 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) checkCacheFile += "/cmake.check_cache"; cmsys::ofstream checkCache(checkCacheFile.c_str()); if (!checkCache) { - cmSystemTools::Error("Unable to open check cache file for write. ", - checkCacheFile.c_str()); + cmSystemTools::Error("Unable to open check cache file for write. " + + checkCacheFile); return false; } checkCache << "# This file is generated by cmake for dependency checking " diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 3d61665..abddc82 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -457,8 +457,8 @@ bool cmComputeLinkInformation::Compute() // We require a link language for the target. if (this->LinkLanguage.empty()) { cmSystemTools::Error( - "CMake can not determine linker language for target: ", - this->Target->GetName().c_str()); + "CMake can not determine linker language for target: " + + this->Target->GetName()); return false; } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index eb52895..69d4374 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -950,8 +950,8 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir) if (binDir.find("CMakeTmp") == std::string::npos) { cmSystemTools::Error( "TRY_COMPILE attempt to remove -rf directory that does not contain " - "CMakeTmp:", - binDir.c_str()); + "CMakeTmp:" + + binDir); return; } diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index b1630f9..f5c106c 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -173,8 +173,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // regex. if (fullName.empty() && this->IncludeRegexComplain.find(current.FileName)) { - cmSystemTools::Error("Cannot find file \"", current.FileName.c_str(), - "\"."); + cmSystemTools::Error("Cannot find file \"" + current.FileName + "\"."); return false; } diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index 75a7786..8cb666a 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -152,7 +152,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, if (!cmSystemTools::FileExists(cmd)) { shortCmd = cmd; } else if (!cmSystemTools::GetShortPath(cmd.c_str(), shortCmd)) { - cmSystemTools::Error("GetShortPath failed for ", cmd.c_str()); + cmSystemTools::Error("GetShortPath failed for " + cmd); return false; } shortCmd += " "; diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index e542e50..0a0646c 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -62,7 +62,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const std::ostream& fout = *foutPtr; if (!fout) { - cmSystemTools::Error("Error Writing ", this->Filename.c_str()); + cmSystemTools::Error("Error Writing " + this->Filename); cmSystemTools::ReportLastSystemError(""); return; } diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 4fe1587..2f47788 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -29,8 +29,7 @@ cmGeneratedFileStream::cmGeneratedFileStream(std::string const& name, { // Check if the file opened. if (!*this && !quiet) { - cmSystemTools::Error("Cannot open file for write: ", - this->TempName.c_str()); + cmSystemTools::Error("Cannot open file for write: " + this->TempName); cmSystemTools::ReportLastSystemError(""); } #ifdef CMAKE_BUILD_WITH_CMAKE @@ -68,8 +67,7 @@ cmGeneratedFileStream& cmGeneratedFileStream::Open(std::string const& name, // Check if the file opened. if (!*this && !quiet) { - cmSystemTools::Error("Cannot open file for write: ", - this->TempName.c_str()); + cmSystemTools::Error("Cannot open file for write: " + this->TempName); cmSystemTools::ReportLastSystemError(""); } return *this; diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx index 5fd890e..9fb4170 100644 --- a/Source/cmGlobVerificationManager.cxx +++ b/Source/cmGlobVerificationManager.cxx @@ -25,8 +25,8 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path) cmGeneratedFileStream verifyScriptFile(scriptFile); verifyScriptFile.SetCopyIfDifferent(true); if (!verifyScriptFile) { - cmSystemTools::Error("Unable to open verification script file for save. ", - scriptFile.c_str()); + cmSystemTools::Error("Unable to open verification script file for save. " + + scriptFile); cmSystemTools::ReportLastSystemError(""); return false; } @@ -71,8 +71,8 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path) cmsys::ofstream verifyStampFile(stampFile.c_str()); if (!verifyStampFile) { - cmSystemTools::Error("Unable to open verification stamp file for write. ", - stampFile.c_str()); + cmSystemTools::Error("Unable to open verification stamp file for write. " + + stampFile); return false; } verifyStampFile << "# This file is generated by CMake for checking of the " diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index fa0ffcc..daec0eb 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -212,7 +212,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang, if (!mf->GetDefinition(langComp)) { if (!optional) { - cmSystemTools::Error(langComp.c_str(), " not set, after EnableLanguage"); + cmSystemTools::Error(langComp + " not set, after EnableLanguage"); } return; } @@ -638,8 +638,7 @@ void cmGlobalGenerator::EnableLanguage( // to avoid duplicate compiler tests. if (cmSystemTools::FileExists(fpath)) { if (!mf->ReadListFile(fpath)) { - cmSystemTools::Error("Could not find cmake module file: ", - fpath.c_str()); + cmSystemTools::Error("Could not find cmake module file: " + fpath); } // if this file was found then the language was already determined // to be working @@ -664,8 +663,8 @@ void cmGlobalGenerator::EnableLanguage( determineCompiler += "Compiler.cmake"; std::string determineFile = mf->GetModulesFile(determineCompiler); if (!mf->ReadListFile(determineFile)) { - cmSystemTools::Error("Could not find cmake module file: ", - determineCompiler.c_str()); + cmSystemTools::Error("Could not find cmake module file: " + + determineCompiler); } if (cmSystemTools::GetFatalErrorOccured()) { return; @@ -699,8 +698,7 @@ void cmGlobalGenerator::EnableLanguage( fpath += lang; fpath += "Compiler.cmake"; if (!mf->ReadListFile(fpath)) { - cmSystemTools::Error("Could not find cmake module file: ", - fpath.c_str()); + cmSystemTools::Error("Could not find cmake module file: " + fpath); } this->SetLanguageEnabledFlag(lang, mf); needSetLanguageEnabledMaps[lang] = true; @@ -792,11 +790,10 @@ void cmGlobalGenerator::EnableLanguage( fpath += "Information.cmake"; std::string informationFile = mf->GetModulesFile(fpath); if (informationFile.empty()) { - cmSystemTools::Error("Could not find cmake module file: ", - fpath.c_str()); + cmSystemTools::Error("Could not find cmake module file: " + fpath); } else if (!mf->ReadListFile(informationFile)) { - cmSystemTools::Error("Could not process cmake module file: ", - informationFile.c_str()); + cmSystemTools::Error("Could not process cmake module file: " + + informationFile); } } if (needSetLanguageEnabledMaps[lang]) { @@ -816,8 +813,8 @@ void cmGlobalGenerator::EnableLanguage( testLang += "Compiler.cmake"; std::string ifpath = mf->GetModulesFile(testLang); if (!mf->ReadListFile(ifpath)) { - cmSystemTools::Error("Could not find cmake module file: ", - testLang.c_str()); + cmSystemTools::Error("Could not find cmake module file: " + + testLang); } std::string compilerWorks = "CMAKE_"; compilerWorks += lang; @@ -1706,8 +1703,8 @@ void cmGlobalGenerator::CheckTargetProperties() cmSystemTools::Error("The following variables are used in this project, " "but they are set to NOTFOUND.\n" "Please set them or make sure they are set and " - "tested correctly in the CMake files:\n", - notFoundVars.c_str()); + "tested correctly in the CMake files:\n" + + notFoundVars); } } @@ -1851,8 +1848,8 @@ int cmGlobalGenerator::Build(int jobs, const std::string& /*unused*/, timeout)) { cmSystemTools::SetRunCommandHideConsole(hideconsole); cmSystemTools::Error( - "Generator: execution of make failed. Make command was: ", - makeCommandStr.c_str()); + "Generator: execution of make failed. Make command was: " + + makeCommandStr); output += *outputPtr; output += "\nGenerator: execution of make failed. Make command was: " + makeCommandStr + "\n"; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 31bcacf..b78ffa9 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -136,16 +136,16 @@ void cmGlobalNinjaGenerator::WriteBuild( // Make sure there is a rule. if (rule.empty()) { cmSystemTools::Error("No rule for WriteBuildStatement! called " - "with comment: ", - comment.c_str()); + "with comment: " + + comment); return; } // Make sure there is at least one output file. if (outputs.empty()) { cmSystemTools::Error("No output files for WriteBuildStatement! called " - "with comment: ", - comment.c_str()); + "with comment: " + + comment); return; } @@ -334,16 +334,16 @@ void cmGlobalNinjaGenerator::WriteRule( // Make sure the rule has a name. if (name.empty()) { cmSystemTools::Error("No name given for WriteRuleStatement! called " - "with comment: ", - comment.c_str()); + "with comment: " + + comment); return; } // Make sure a command is given. if (command.empty()) { cmSystemTools::Error("No command given for WriteRuleStatement! called " - "with comment: ", - comment.c_str()); + "with comment: " + + comment); return; } @@ -376,7 +376,7 @@ void cmGlobalNinjaGenerator::WriteRule( if (!rspfile.empty()) { if (rspcontent.empty()) { - cmSystemTools::Error("No rspfile_content given!", comment.c_str()); + cmSystemTools::Error("No rspfile_content given!" + comment); return; } cmGlobalNinjaGenerator::Indent(os, 1); @@ -407,8 +407,8 @@ void cmGlobalNinjaGenerator::WriteVariable(std::ostream& os, // Make sure we have a name. if (name.empty()) { cmSystemTools::Error("No name given for WriteVariable! called " - "with comment: ", - comment.c_str()); + "with comment: " + + comment); return; } @@ -1652,8 +1652,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, } else if (cmHasLiteralPrefix(arg, "--ddi=")) { arg_ddi = arg.substr(6); } else { - cmSystemTools::Error("-E cmake_ninja_depends unknown argument: ", - arg.c_str()); + cmSystemTools::Error("-E cmake_ninja_depends unknown argument: " + arg); return 1; } } @@ -1687,9 +1686,8 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, cmsys::ifstream tdif(arg_tdi.c_str(), std::ios::in | std::ios::binary); Json::Reader reader; if (!reader.parse(tdif, tdio, false)) { - cmSystemTools::Error("-E cmake_ninja_depends failed to parse ", - arg_tdi.c_str(), - reader.getFormattedErrorMessages().c_str()); + cmSystemTools::Error("-E cmake_ninja_depends failed to parse " + + arg_tdi + reader.getFormattedErrorMessages()); return 1; } } @@ -1715,8 +1713,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, std::set<std::string> defines; cmFortranParser parser(fc, includes, defines, info); if (!cmFortranParser_FilePush(&parser, arg_pp.c_str())) { - cmSystemTools::Error("-E cmake_ninja_depends failed to open ", - arg_pp.c_str()); + cmSystemTools::Error("-E cmake_ninja_depends failed to open " + arg_pp); return 1; } if (cmFortran_yyparse(parser.Scanner) != 0) { @@ -1751,8 +1748,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, cmGeneratedFileStream ddif(arg_ddi); ddif << ddi; if (!ddif) { - cmSystemTools::Error("-E cmake_ninja_depends failed to write ", - arg_ddi.c_str()); + cmSystemTools::Error("-E cmake_ninja_depends failed to write " + arg_ddi); return 1; } return 0; @@ -1795,9 +1791,8 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( cmsys::ifstream ddif(arg_ddi.c_str(), std::ios::in | std::ios::binary); Json::Reader reader; if (!reader.parse(ddif, ddio, false)) { - cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse ", - arg_ddi.c_str(), - reader.getFormattedErrorMessages().c_str()); + cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse " + arg_ddi + + reader.getFormattedErrorMessages()); return false; } @@ -1828,9 +1823,9 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( cmsys::ifstream ltmf(ltmn.c_str(), std::ios::in | std::ios::binary); Json::Reader reader; if (ltmf && !reader.parse(ltmf, ltm, false)) { - cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse ", - linked_target_dir.c_str(), - reader.getFormattedErrorMessages().c_str()); + cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse " + + linked_target_dir + + reader.getFormattedErrorMessages()); return false; } if (ltm.isObject()) { @@ -1911,8 +1906,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, cmHasLiteralSuffix(arg, ".ddi")) { arg_ddis.push_back(arg); } else { - cmSystemTools::Error("-E cmake_ninja_dyndep unknown argument: ", - arg.c_str()); + cmSystemTools::Error("-E cmake_ninja_dyndep unknown argument: " + arg); return 1; } } @@ -1931,9 +1925,8 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, cmsys::ifstream tdif(arg_tdi.c_str(), std::ios::in | std::ios::binary); Json::Reader reader; if (!reader.parse(tdif, tdio, false)) { - cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse ", - arg_tdi.c_str(), - reader.getFormattedErrorMessages().c_str()); + cmSystemTools::Error("-E cmake_ninja_dyndep failed to parse " + arg_tdi + + reader.getFormattedErrorMessages()); return 1; } } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index f6db018..ceb56d1 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -205,7 +205,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() "Checking Build System", no_working_directory, true, false)) { gt->AddSource(file->GetFullPath()); } else { - cmSystemTools::Error("Error adding rule for ", stamps[0].c_str()); + cmSystemTools::Error("Error adding rule for " + stamps[0]); } } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 1922906..45927c9 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -918,7 +918,7 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( cmdl.push_back(objs_file); cmGeneratedFileStream fout(objs_file.c_str()); if (!fout) { - cmSystemTools::Error("could not open ", objs_file.c_str()); + cmSystemTools::Error("could not open " + objs_file); return; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 8393165..90f1c00 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -366,8 +366,8 @@ void cmLocalGenerator::ProcessEvaluationFiles( std::back_inserter(intersection)); if (!intersection.empty()) { cmSystemTools::Error("Files to be generated by multiple different " - "commands: ", - cmWrap('"', intersection, '"', " ").c_str()); + "commands: " + + cmWrap('"', intersection, '"', " ")); return; } @@ -1168,8 +1168,8 @@ void cmLocalGenerator::GetTargetFlags( } if (linkLanguage.empty()) { cmSystemTools::Error( - "CMake can not determine linker language for target: ", - target->GetName().c_str()); + "CMake can not determine linker language for target: " + + target->GetName()); return; } this->AddLanguageFlagsForLinking(flags, target, linkLanguage, buildType); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 4dc04d5..f4e3ed8 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -232,8 +232,8 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os) os << " depth = " << jobs << std::endl; os << std::endl; } else { - cmSystemTools::Error("Invalid pool defined by property 'JOB_POOLS': ", - pool.c_str()); + cmSystemTools::Error("Invalid pool defined by property 'JOB_POOLS': " + + pool); } } } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 7eb4a03..f8e7441 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1054,7 +1054,7 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand( std::string cleanfilePath = cmSystemTools::CollapseFullPath(cleanfile); cmsys::ofstream fout(cleanfilePath.c_str()); if (!fout) { - cmSystemTools::Error("Could not create ", cleanfilePath.c_str()); + cmSystemTools::Error("Could not create " + cleanfilePath); } if (!files.empty()) { fout << "file(REMOVE_RECURSE\n"; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 9f18e8f..a497308 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -118,8 +118,8 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles() // If not an in source build, then create the output directory if (this->GetCurrentBinaryDirectory() != this->GetSourceDirectory()) { if (!cmSystemTools::MakeDirectory(this->GetCurrentBinaryDirectory())) { - cmSystemTools::Error("Error creating directory ", - this->GetCurrentBinaryDirectory().c_str()); + cmSystemTools::Error("Error creating directory " + + this->GetCurrentBinaryDirectory()); } } @@ -283,7 +283,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() file->GetFullPath(); return file; } else { - cmSystemTools::Error("Error adding rule for ", makefileIn.c_str()); + cmSystemTools::Error("Error adding rule for " + makefileIn); return nullptr; } } @@ -654,8 +654,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( : target->GetLinkerLanguage(configName)); if (linkLanguage.empty()) { cmSystemTools::Error( - "CMake can not determine linker language for target: ", - target->GetName().c_str()); + "CMake can not determine linker language for target: " + + target->GetName()); return; } langForClCompile = linkLanguage; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0a0501b..f66999f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -959,9 +959,8 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput( if (file && file->GetCustomCommand() && !replace) { // The rule file already exists. if (commandLines != file->GetCustomCommand()->GetCommandLines()) { - cmSystemTools::Error("Attempt to add a custom rule to output \"", - outName.c_str(), - "\" which already has a custom rule."); + cmSystemTools::Error("Attempt to add a custom rule to output \"" + + outName + "\" which already has a custom rule."); } return file; } @@ -1101,8 +1100,8 @@ void cmMakefile::AddCustomCommandOldStyle( ti->second.AddSource(sf->GetFullPath()); } else { cmSystemTools::Error("Attempt to add a custom rule to a target " - "that does not exist yet for target ", - target.c_str()); + "that does not exist yet for target " + + target); return; } } @@ -1189,8 +1188,7 @@ cmTarget* cmMakefile::AddUtilityCommand( if (sf) { sf->SetProperty("SYMBOLIC", "1"); } else { - cmSystemTools::Error("Could not get source file entry for ", - force.c_str()); + cmSystemTools::Error("Could not get source file entry for " + force); } // Always create the byproduct sources and mark them generated. @@ -2445,8 +2443,9 @@ const std::string& cmMakefile::GetRequiredDefinition( const std::string* def = GetDef(name); if (!def) { cmSystemTools::Error("Error required internal CMake variable not " - "set, cmake may not be built correctly.\n", - "Missing variable is:\n", name.c_str()); + "set, cmake may not be built correctly.\n" + "Missing variable is:\n" + + name); return empty; } return *def; @@ -3779,15 +3778,15 @@ int cmMakefile::ConfigureFile(const std::string& infile, tempOutputFile += ".tmp"; cmsys::ofstream fout(tempOutputFile.c_str(), omode); if (!fout) { - cmSystemTools::Error("Could not open file for write in copy operation ", - tempOutputFile.c_str()); + cmSystemTools::Error("Could not open file for write in copy operation " + + tempOutputFile); cmSystemTools::ReportLastSystemError(""); return 0; } cmsys::ifstream fin(sinfile.c_str()); if (!fin) { - cmSystemTools::Error("Could not open file for read in copy operation ", - sinfile.c_str()); + cmSystemTools::Error("Could not open file for read in copy operation " + + sinfile); return 0; } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 572270a..984cd85 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -370,8 +370,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Make sure we have a link language. if (linkLanguage.empty()) { - cmSystemTools::Error("Cannot determine link language for target \"", - this->GeneratorTarget->GetName().c_str(), "\"."); + cmSystemTools::Error("Cannot determine link language for target \"" + + this->GeneratorTarget->GetName() + "\"."); return; } diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index ed2fd68..44e6547 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -462,8 +462,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // Make sure we have a link language. if (linkLanguage.empty()) { - cmSystemTools::Error("Cannot determine link language for target \"", - this->GeneratorTarget->GetName().c_str(), "\"."); + cmSystemTools::Error("Cannot determine link language for target \"" + + this->GeneratorTarget->GetName() + "\"."); return; } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 3784313..3264237 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -68,8 +68,8 @@ void cmNinjaNormalTargetGenerator::Generate() { if (this->TargetLinkLanguage.empty()) { cmSystemTools::Error("CMake can not determine linker language for " - "target: ", - this->GetGeneratorTarget()->GetName().c_str()); + "target: " + + this->GetGeneratorTarget()->GetName()); return; } diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index e0c1dad..cb9433f 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -166,7 +166,7 @@ protected: { cmsys::ifstream fin(info->FullPath.c_str()); if (!fin) { - cmSystemTools::Error("error can not open ", info->FullPath.c_str()); + cmSystemTools::Error("error can not open " + info->FullPath); return; } @@ -181,7 +181,7 @@ protected: qstart = line.find('<', 8); // if a < is not found then move on if (qstart == std::string::npos) { - cmSystemTools::Error("unknown include directive ", line.c_str()); + cmSystemTools::Error("unknown include directive " + line); continue; } qend = line.find('>', qstart + 1); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index f0e8077..1ca2360 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1425,12 +1425,12 @@ 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.c_str()); + cmSystemTools::Error("RelativePath must be passed a full path to local: " + + local); } if (!cmSystemTools::FileIsFullPath(remote)) { - cmSystemTools::Error("RelativePath must be passed a full path to remote: ", - remote.c_str()); + cmSystemTools::Error( + "RelativePath must be passed a full path to remote: " + remote); } return cmsys::SystemTools::RelativePath(local, remote); } @@ -1909,8 +1909,8 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract) else { cmSystemTools::Error("Problem with archive_write_header(): ", archive_error_string(ext)); - cmSystemTools::Error("Current file: ", - cm_archive_entry_pathname(entry).c_str()); + cmSystemTools::Error("Current file: " + + cm_archive_entry_pathname(entry)); break; } } diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 9648b21..e4a1b5f 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -19,7 +19,7 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args, this->SetError("called with incorrect number of arguments"); return false; } - const char* inputDir = args[0].c_str(); + const std::string& inputDir = args[0]; std::string glh = inputDir; glh += "/"; glh += "gl.h"; @@ -34,7 +34,7 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args, std::vector<std::string> files; cmSystemTools::Glob(inputDir, "\\.h$", files); if (files.empty()) { - cmSystemTools::Error("Could not open Mesa Directory ", inputDir); + cmSystemTools::Error("Could not open Mesa Directory " + inputDir); return false; } cmSystemTools::MakeDirectory(destDir); @@ -60,8 +60,8 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source, tempOutputFile += ".tmp"; cmsys::ofstream fout(tempOutputFile.c_str()); if (!fout) { - cmSystemTools::Error("Could not open file for write in copy operation: ", - tempOutputFile.c_str(), outdir); + cmSystemTools::Error("Could not open file for write in copy operation: " + + tempOutputFile + outdir); cmSystemTools::ReportLastSystemError(""); return; } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6ee82f4..b655815 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1321,8 +1321,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( std::string error = "Could not create file: ["; error += sourcePath; error += "] "; - cmSystemTools::Error(error.c_str(), - cmSystemTools::GetLastSystemError().c_str()); + cmSystemTools::Error(error + cmSystemTools::GetLastSystemError()); } } } @@ -2514,8 +2513,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( this->GeneratorTarget->GetLinkerLanguage(configName); if (linkLanguage.empty()) { cmSystemTools::Error( - "CMake can not determine linker language for target: ", - this->Name.c_str()); + "CMake can not determine linker language for target: " + this->Name); return false; } @@ -3345,8 +3343,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( const std::string& linkLanguage = linkClosure->LinkerLanguage; if (linkLanguage.empty()) { cmSystemTools::Error( - "CMake can not determine linker language for target: ", - this->Name.c_str()); + "CMake can not determine linker language for target: " + this->Name); return false; } @@ -3391,8 +3388,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( this->GeneratorTarget->GetLinkInformation(config); if (!pcli) { cmSystemTools::Error( - "CMake can not compute cmComputeLinkInformation for target: ", - this->Name.c_str()); + "CMake can not compute cmComputeLinkInformation for target: " + + this->Name); return false; } cmComputeLinkInformation& cli = *pcli; @@ -3572,8 +3569,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions( this->GeneratorTarget->GetLinkInformation(config); if (!pcli) { cmSystemTools::Error( - "CMake can not compute cmComputeLinkInformation for target: ", - this->Name.c_str()); + "CMake can not compute cmComputeLinkInformation for target: " + + this->Name); return false; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ab783c7..f6f0a95 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -788,13 +788,13 @@ void cmake::SetArgs(const std::vector<std::string>& args) } cmGlobalGenerator* gen = this->CreateGlobalGenerator(value); if (!gen) { - const char* kdevError = nullptr; + std::string kdevError; if (value.find("KDevelop3", 0) != std::string::npos) { kdevError = "\nThe KDevelop3 generator is not supported anymore."; } - cmSystemTools::Error("Could not create named generator ", - value.c_str(), kdevError); + cmSystemTools::Error("Could not create named generator " + value + + kdevError); this->PrintGeneratorList(); } else { this->SetGlobalGenerator(gen); @@ -938,8 +938,8 @@ int cmake::AddCMakePaths() cmSystemTools::Error( "Could not find CMAKE_ROOT !!!\n" "CMake has most likely not been installed correctly.\n" - "Modules directory not found in\n", - cmSystemTools::GetCMakeRoot().c_str()); + "Modules directory not found in\n" + + cmSystemTools::GetCMakeRoot()); return 0; } this->AddCacheEntry("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(), @@ -2016,8 +2016,8 @@ void cmake::UpdateConversionPathTable() if (tablepath) { cmsys::ifstream table(tablepath->c_str()); if (!table) { - cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to ", - tablepath->c_str(), ". CMake can not open file."); + cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to " + *tablepath + + ". CMake can not open file."); cmSystemTools::ReportLastSystemError("CMake can not open file."); } else { std::string a, b; @@ -2325,8 +2325,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) } cmGlobalGenerator* gen = this->CreateGlobalGenerator(value); if (!gen) { - cmSystemTools::Error("Could not create named generator ", - value.c_str()); + cmSystemTools::Error("Could not create named generator " + value); this->PrintGeneratorList(); } else { this->SetGlobalGenerator(gen); @@ -2473,7 +2472,7 @@ static bool cmakeCheckStampFile(const std::string& stampName, bool verbose) return true; } cmSystemTools::RemoveFile(stampTemp); - cmSystemTools::Error("Cannot restore timestamp ", stampName.c_str()); + cmSystemTools::Error("Cannot restore timestamp " + stampName); return false; } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index adfce37..1139a4c 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -817,8 +817,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) if (args[1] == "chdir" && args.size() >= 4) { std::string const& directory = args[2]; if (!cmSystemTools::FileExists(directory)) { - cmSystemTools::Error("Directory does not exist for chdir command: ", - args[2].c_str()); + cmSystemTools::Error("Directory does not exist for chdir command: " + + args[2]); return 1; } @@ -1065,12 +1065,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) format) != cm::cend(knownFormats); if (!isKnown) { - cmSystemTools::Error("Unknown -E tar --format= argument: ", - format.c_str()); + cmSystemTools::Error("Unknown -E tar --format= argument: " + + format); return 1; } } else { - cmSystemTools::Error("Unknown option to -E tar: ", arg.c_str()); + cmSystemTools::Error("Unknown option to -E tar: " + arg); return 1; } } else { @@ -1094,8 +1094,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) ++nCompress; } if ((format == "7zip" || format == "zip") && nCompress > 0) { - cmSystemTools::Error("Can not use compression flags with format: ", - format.c_str()); + cmSystemTools::Error("Can not use compression flags with format: " + + format); return 1; } if (nCompress > 1) { @@ -1109,18 +1109,18 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) if (flags.find_first_of('t') != std::string::npos) { if (!cmSystemTools::ListTar(outFile.c_str(), verbose)) { - cmSystemTools::Error("Problem listing tar: ", outFile.c_str()); + cmSystemTools::Error("Problem listing tar: " + outFile); return 1; } } else if (flags.find_first_of('c') != std::string::npos) { if (!cmSystemTools::CreateTar(outFile.c_str(), files, compress, verbose, mtime, format)) { - cmSystemTools::Error("Problem creating tar: ", outFile.c_str()); + cmSystemTools::Error("Problem creating tar: " + outFile); return 1; } } else if (flags.find_first_of('x') != std::string::npos) { if (!cmSystemTools::ExtractTar(outFile.c_str(), verbose)) { - cmSystemTools::Error("Problem extracting tar: ", outFile.c_str()); + cmSystemTools::Error("Problem extracting tar: " + outFile); return 1; } #ifdef WIN32 |