cmSystemTools::Error(): new overload accepting std::string

This commit is contained in:
Vitaly Stakhovsky 2019-01-23 10:12:17 -05:00
parent a7f5cd45e1
commit 99337d345b
23 changed files with 62 additions and 54 deletions

View File

@ -720,7 +720,7 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir,
ext != headerExts.end(); ++ext) { ext != headerExts.end(); ++ext) {
e << " ." << *ext; e << " ." << *ext;
} }
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
} }
void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir, void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir,

View File

@ -2173,7 +2173,7 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
// handle the simple commandline arguments // handle the simple commandline arguments
std::string errormsg; std::string errormsg;
if (!this->HandleCommandLineArguments(i, args, errormsg)) { if (!this->HandleCommandLineArguments(i, args, errormsg)) {
cmSystemTools::Error(errormsg.c_str()); cmSystemTools::Error(errormsg);
return 1; return 1;
} }

View File

@ -123,7 +123,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
std::ostringstream error; std::ostringstream error;
error << "Parse error in cache file " << cacheFile; error << "Parse error in cache file " << cacheFile;
error << " on line " << lineno << ". Offending entry: " << realbuffer; error << " on line " << lineno << ". Offending entry: " << realbuffer;
cmSystemTools::Error(error.str().c_str()); cmSystemTools::Error(error.str());
} }
} }
this->CacheMajorVersion = 0; this->CacheMajorVersion = 0;
@ -171,7 +171,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
<< " where CMakeCache.txt was created. This may result " << " where CMakeCache.txt was created. This may result "
"in binaries being created in the wrong place. If you " "in binaries being created in the wrong place. If you "
"are not sure, reedit the CMakeCache.txt"; "are not sure, reedit the CMakeCache.txt";
cmSystemTools::Error(message.str().c_str()); cmSystemTools::Error(message.str());
} }
} }
return true; return true;

View File

@ -1237,7 +1237,7 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
std::ostringstream e; std::ostringstream e;
e << "Could not parse framework path \"" << item << "\" " e << "Could not parse framework path \"" << item << "\" "
<< "linked by target " << this->Target->GetName() << "."; << "linked by target " << this->Target->GetName() << ".";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return; return;
} }

View File

@ -495,7 +495,7 @@ void cmComputeTargetDepends::ComplainAboutBadComponent(
e << "At least one of these targets is not a STATIC_LIBRARY. " e << "At least one of these targets is not a STATIC_LIBRARY. "
<< "Cyclic dependencies are allowed only among static libraries."; << "Cyclic dependencies are allowed only among static libraries.";
} }
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
} }
bool cmComputeTargetDepends::IntraComponent(std::vector<int> const& cmap, bool cmComputeTargetDepends::IntraComponent(std::vector<int> const& cmap,

View File

@ -83,7 +83,7 @@ bool cmExportFileGenerator::GenerateImportFile()
std::string se = cmSystemTools::GetLastSystemError(); std::string se = cmSystemTools::GetLastSystemError();
std::ostringstream e; std::ostringstream e;
e << "cannot write to file \"" << this->MainImportFile << "\": " << se; e << "cannot write to file \"" << this->MainImportFile << "\": " << se;
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return false; return false;
} }
std::ostream& os = *foutPtr; std::ostream& os = *foutPtr;

View File

@ -54,7 +54,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
<< "\" ...) " << "\" ...) "
<< "includes target \"" << te->Target->GetName() << "includes target \"" << te->Target->GetName()
<< "\" more than once in the export set."; << "\" more than once in the export set.";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return false; return false;
} }
} }
@ -112,7 +112,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std::string errorMessage; std::string errorMessage;
if (!this->PopulateExportProperties(gt, properties, errorMessage)) { if (!this->PopulateExportProperties(gt, properties, errorMessage)) {
cmSystemTools::Error(errorMessage.c_str()); cmSystemTools::Error(errorMessage);
return false; return false;
} }
@ -294,7 +294,7 @@ bool cmExportInstallFileGenerator::GenerateImportFileConfig(
std::string se = cmSystemTools::GetLastSystemError(); std::string se = cmSystemTools::GetLastSystemError();
std::ostringstream e; std::ostringstream e;
e << "cannot write to file \"" << fileName << "\": " << se; e << "cannot write to file \"" << fileName << "\": " << se;
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return false; return false;
} }
std::ostream& os = exportFileStream; std::ostream& os = exportFileStream;
@ -518,7 +518,7 @@ void cmExportInstallFileGenerator::ComplainAboutMissingTarget(
e << "that is not in this export set, but " << occurrences e << "that is not in this export set, but " << occurrences
<< " times in others."; << " times in others.";
} }
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
} }
std::string cmExportInstallFileGenerator::InstallNameDir( std::string cmExportInstallFileGenerator::InstallNameDir(

View File

@ -203,7 +203,7 @@ std::string cmGeneratorTarget::GetExportName() const
std::ostringstream e; std::ostringstream e;
e << "EXPORT_NAME property \"" << exportName << "\" for \"" e << "EXPORT_NAME property \"" << exportName << "\" for \""
<< this->GetName() << "\": is not valid."; << this->GetName() << "\": is not valid.";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return ""; return "";
} }
return exportName; return exportName;
@ -4587,7 +4587,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
<< " property requirement\nof " << " property requirement\nof "
"dependency \"" "dependency \""
<< theTarget->GetName() << "\".\n"; << theTarget->GetName() << "\".\n";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
break; break;
} }
propContent = consistent.second; propContent = consistent.second;
@ -4612,7 +4612,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
"already. The INTERFACE_" "already. The INTERFACE_"
<< p << " property on\ndependency \"" << theTarget->GetName() << p << " property on\ndependency \"" << theTarget->GetName()
<< "\" is in conflict.\n"; << "\" is in conflict.\n";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
break; break;
} }
propContent = consistent.second; propContent = consistent.second;
@ -4632,7 +4632,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
e << "The INTERFACE_" << p << " property of \"" e << "The INTERFACE_" << p << " property of \""
<< theTarget->GetName() << "\" does\nnot agree with the value of " << theTarget->GetName() << "\" does\nnot agree with the value of "
<< p << " already determined\nfor \"" << tgt->GetName() << "\".\n"; << p << " already determined\nfor \"" << tgt->GetName() << "\".\n";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
break; break;
} }
propContent = consistent.second; propContent = consistent.second;

View File

@ -165,7 +165,7 @@ void cmGlobVerificationManager::AddCacheEntry(
message << "\n " << std::get<0>(bt); message << "\n " << std::get<0>(bt);
std::get<1>(bt).PrintTitle(message); std::get<1>(bt).PrintTitle(message);
} }
cmSystemTools::Error(message.str().c_str()); cmSystemTools::Error(message.str());
} else { } else {
value.Backtraces.emplace_back(variable, backtrace); value.Backtraces.emplace_back(variable, backtrace);
} }

View File

@ -364,7 +364,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
err << "CMake was unable to find a build program corresponding to \"" err << "CMake was unable to find a build program corresponding to \""
<< this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You " << this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You "
<< "probably need to select a different build tool."; << "probably need to select a different build tool.";
cmSystemTools::Error(err.str().c_str()); cmSystemTools::Error(err.str());
cmSystemTools::SetFatalErrorOccured(); cmSystemTools::SetFatalErrorOccured();
return false; return false;
} }
@ -1282,7 +1282,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const
<< "duplicate custom targets. " << "duplicate custom targets. "
<< "Consider using a Makefiles generator or fix the project to not " << "Consider using a Makefiles generator or fix the project to not "
<< "use duplicate target names."; << "use duplicate target names.";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return false; return false;
} }

View File

@ -93,7 +93,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
message += prevTool; message += prevTool;
message += "\nEither remove the CMakeCache.txt file and CMakeFiles " message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory."; "directory or choose a different binary directory.";
cmSystemTools::Error(message.c_str()); cmSystemTools::Error(message);
return false; return false;
} else { } else {
/* store the toolset that is being used for this build */ /* store the toolset that is being used for this build */
@ -178,7 +178,7 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd,
if (output.empty()) { if (output.empty()) {
std::string msg = std::string msg =
"No GHS toolsets found in GHS_TOOLSET_ROOT \"" + tsd + "\"."; "No GHS toolsets found in GHS_TOOLSET_ROOT \"" + tsd + "\".";
cmSystemTools::Error(msg.c_str()); cmSystemTools::Error(msg);
tsd = ""; tsd = "";
} else { } else {
tsd += output.back(); tsd += output.back();
@ -189,7 +189,7 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd,
tryPath = cmSystemTools::CollapseCombinedPath(tsd, ts); tryPath = cmSystemTools::CollapseCombinedPath(tsd, ts);
if (!cmSystemTools::FileExists(tryPath)) { if (!cmSystemTools::FileExists(tryPath)) {
std::string msg = "GHS toolset \"" + tryPath + "\" not found."; std::string msg = "GHS toolset \"" + tryPath + "\" not found.";
cmSystemTools::Error(msg.c_str()); cmSystemTools::Error(msg);
tsd = ""; tsd = "";
} else { } else {
tsd = tryPath; tsd = tryPath;

View File

@ -149,7 +149,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(
m += target->GetName(); m += target->GetName();
m += " depends on unknown target: "; m += " depends on unknown target: ";
m += name; m += name;
cmSystemTools::Error(m.c_str()); cmSystemTools::Error(m);
} }
fout << "\t\t{" << guid << "} = {" << guid << "}\n"; fout << "\t\t{" << guid << "} = {" << guid << "}\n";
} }

View File

@ -127,7 +127,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
std::ostringstream e; std::ostringstream e;
e << "INSTALL(EXPORT) given unknown export \"" << ExportSet->GetName() e << "INSTALL(EXPORT) given unknown export \"" << ExportSet->GetName()
<< "\""; << "\"";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return; return;
} }

View File

@ -1794,7 +1794,7 @@ static void AddVisibilityCompileOption(std::string& flags,
std::ostringstream e; std::ostringstream e;
e << "Target " << target->GetName() << " uses unsupported value \"" << prop e << "Target " << target->GetName() << " uses unsupported value \"" << prop
<< "\" for " << flagDefine << "."; << "\" for " << flagDefine << ".";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return; return;
} }
std::string option = std::string(opt) + prop; std::string option = std::string(opt) + prop;
@ -2800,7 +2800,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
std::ostringstream e; std::ostringstream e;
e << "Target " << target->GetName() << " Info.plist template \"" << inFile e << "Target " << target->GetName() << " Info.plist template \"" << inFile
<< "\" could not be found."; << "\" could not be found.";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return; return;
} }
@ -2838,7 +2838,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(
std::ostringstream e; std::ostringstream e;
e << "Target " << target->GetName() << " Info.plist template \"" << inFile e << "Target " << target->GetName() << " Info.plist template \"" << inFile
<< "\" could not be found."; << "\" could not be found.";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return; return;
} }

View File

@ -194,7 +194,7 @@ protected:
message += includeFile; message += includeFile;
message += " for file "; message += " for file ";
message += info->FullPath; message += info->FullPath;
cmSystemTools::Error(message.c_str(), nullptr); cmSystemTools::Error(message);
} }
continue; continue;
} }

View File

@ -111,7 +111,7 @@ static bool AddToSourceGroup(cmMakefile* makefile, std::string const& fileName,
ost << ": " << property; ost << ": " << property;
ost << ": Could not find or create the source group "; ost << ": Could not find or create the source group ";
ost << cmQtAutoGen::Quoted(groupName); ost << cmQtAutoGen::Quoted(groupName);
cmSystemTools::Error(ost.str().c_str()); cmSystemTools::Error(ost.str());
return false; return false;
} }
} }
@ -941,7 +941,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
if (!qrc.Generated) { if (!qrc.Generated) {
std::string error; std::string error;
if (!RccListInputs(qrc.QrcFile, qrc.Resources, error)) { if (!RccListInputs(qrc.QrcFile, qrc.Resources, error)) {
cmSystemTools::Error(error.c_str()); cmSystemTools::Error(error);
return false; return false;
} }
} }
@ -1219,7 +1219,7 @@ bool cmQtAutoGenInitializer::SetupCustomTargets()
if (!cmSystemTools::MakeDirectory(this->Dir.Info)) { if (!cmSystemTools::MakeDirectory(this->Dir.Info)) {
std::string emsg = ("AutoGen: Could not create directory: "); std::string emsg = ("AutoGen: Could not create directory: ");
emsg += Quoted(this->Dir.Info); emsg += Quoted(this->Dir.Info);
cmSystemTools::Error(emsg.c_str()); cmSystemTools::Error(emsg);
return false; return false;
} }
@ -1307,7 +1307,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
} else { } else {
std::string err = "AutoGen: Could not write file "; std::string err = "AutoGen: Could not write file ";
err += this->AutogenTarget.InfoFile; err += this->AutogenTarget.InfoFile;
cmSystemTools::Error(err.c_str()); cmSystemTools::Error(err);
return false; return false;
} }
@ -1347,7 +1347,7 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
} else { } else {
std::string err = "AutoRcc: Could not write file "; std::string err = "AutoRcc: Could not write file ";
err += qrc.InfoFile; err += qrc.InfoFile;
cmSystemTools::Error(err.c_str()); cmSystemTools::Error(err);
return false; return false;
} }
} }
@ -1512,7 +1512,7 @@ std::pair<bool, std::string> GetQtExecutable(
msg += target->GetName(); msg += target->GetName();
msg += "): "; msg += "): ";
msg += err; msg += err;
cmSystemTools::Error(msg.c_str()); cmSystemTools::Error(msg);
return std::make_pair(false, ""); return std::make_pair(false, "");
} }

View File

@ -270,6 +270,13 @@ void cmSystemTools::Error(const char* m1, const char* m2, const char* m3,
cmSystemTools::Message(message.c_str(), "Error"); cmSystemTools::Message(message.c_str(), "Error");
} }
void cmSystemTools::Error(const std::string& m)
{
std::string message = "CMake Error: " + m;
cmSystemTools::s_ErrorOccured = true;
cmSystemTools::Message(message.c_str(), "Error");
}
void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData) void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData)
{ {
s_InterruptCallback = f; s_InterruptCallback = f;
@ -338,7 +345,7 @@ void cmSystemTools::ReportLastSystemError(const char* msg)
std::string m = msg; std::string m = msg;
m += ": System Error: "; m += ": System Error: ";
m += Superclass::GetLastSystemError(); m += Superclass::GetLastSystemError();
cmSystemTools::Error(m.c_str()); cmSystemTools::Error(m);
} }
bool cmSystemTools::IsInternallyOn(const char* val) bool cmSystemTools::IsInternallyOn(const char* val)
@ -549,7 +556,7 @@ std::vector<std::string> cmSystemTools::HandleResponseFile(
error += cmSystemTools::GetLastSystemError(); error += cmSystemTools::GetLastSystemError();
error += "):\n "; error += "):\n ";
error += arg.substr(1); error += arg.substr(1);
cmSystemTools::Error(error.c_str()); cmSystemTools::Error(error);
} else { } else {
std::string line; std::string line;
cmSystemTools::GetLineFromStream(responseFile, line); cmSystemTools::GetLineFromStream(responseFile, line);
@ -1651,7 +1658,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
e += outFileName; e += outFileName;
e += "\": "; e += "\": ";
e += cmSystemTools::GetLastSystemError(); e += cmSystemTools::GetLastSystemError();
cmSystemTools::Error(e.c_str()); cmSystemTools::Error(e);
return false; return false;
} }
cmArchiveWrite::Compress compress = cmArchiveWrite::CompressNone; cmArchiveWrite::Compress compress = cmArchiveWrite::CompressNone;
@ -1684,7 +1691,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
} }
} }
if (!a) { if (!a) {
cmSystemTools::Error(a.GetError().c_str()); cmSystemTools::Error(a.GetError());
return false; return false;
} }
return true; return true;
@ -3120,7 +3127,7 @@ bool cmSystemTools::CreateSymlink(const std::string& origName,
if (errorMessage) { if (errorMessage) {
*errorMessage = std::move(e); *errorMessage = std::move(e);
} else { } else {
cmSystemTools::Error(e.c_str()); cmSystemTools::Error(e);
} }
return false; return false;
} }
@ -3141,7 +3148,7 @@ bool cmSystemTools::CreateLink(const std::string& origName,
if (errorMessage) { if (errorMessage) {
*errorMessage = std::move(e); *errorMessage = std::move(e);
} else { } else {
cmSystemTools::Error(e.c_str()); cmSystemTools::Error(e);
} }
return false; return false;
} }

View File

@ -70,6 +70,7 @@ public:
*/ */
static void Error(const char* m, const char* m2 = nullptr, static void Error(const char* m, const char* m2 = nullptr,
const char* m3 = nullptr, const char* m4 = nullptr); const char* m3 = nullptr, const char* m4 = nullptr);
static void Error(const std::string& m);
/** /**
* Display a message. * Display a message.

View File

@ -121,7 +121,7 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
// now try running the command if it compiled // now try running the command if it compiled
if (!res) { if (!res) {
if (this->OutputFile.empty()) { if (this->OutputFile.empty()) {
cmSystemTools::Error(this->FindErrorMessage.c_str()); cmSystemTools::Error(this->FindErrorMessage);
} else { } else {
// "run" it and capture the output // "run" it and capture the output
std::string runOutputContents; std::string runOutputContents;
@ -354,7 +354,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
errorMessage += " " + internalRunOutputName + " (advanced)\n"; errorMessage += " " + internalRunOutputName + " (advanced)\n";
} }
errorMessage += detailsString; errorMessage += detailsString;
cmSystemTools::Error(errorMessage.c_str()); cmSystemTools::Error(errorMessage);
return; return;
} }

View File

@ -57,7 +57,7 @@ bool cmVariableRequiresCommand::InitialPass(
"One or more of the required variables is advanced." "One or more of the required variables is advanced."
" To set the variable, you must turn on advanced mode in cmake."; " To set the variable, you must turn on advanced mode in cmake.";
} }
cmSystemTools::Error(message.c_str()); cmSystemTools::Error(message);
} }
return true; return true;

View File

@ -60,7 +60,7 @@ static void cmVariableWatchCommandVariableAccessed(const std::string& variable,
error << "Error in cmake code at\nUnknown:0:\n" error << "Error in cmake code at\nUnknown:0:\n"
<< "A command failed during the invocation of callback \"" << "A command failed during the invocation of callback \""
<< data->Command << "\"."; << data->Command << "\".";
cmSystemTools::Error(error.str().c_str()); cmSystemTools::Error(error.str());
data->InCallback = false; data->InCallback = false;
return; return;
} }

View File

@ -1172,7 +1172,7 @@ int cmake::DoPreConfigureChecks()
} }
err << "Specify --help for usage, or press the help button on the CMake " err << "Specify --help for usage, or press the help button on the CMake "
"GUI."; "GUI.";
cmSystemTools::Error(err.str().c_str()); cmSystemTools::Error(err.str());
return -2; return -2;
} }
@ -1190,7 +1190,7 @@ int cmake::DoPreConfigureChecks()
message += cacheStart; message += cacheStart;
message += "\" used to generate cache. "; message += "\" used to generate cache. ";
message += "Re-run cmake with a different source directory."; message += "Re-run cmake with a different source directory.";
cmSystemTools::Error(message.c_str()); cmSystemTools::Error(message);
return -2; return -2;
} }
} else { } else {
@ -1400,7 +1400,7 @@ int cmake::ActualConfigure()
message += *genName; message += *genName;
message += "\nEither remove the CMakeCache.txt file and CMakeFiles " message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory."; "directory or choose a different binary directory.";
cmSystemTools::Error(message.c_str()); cmSystemTools::Error(message);
return -2; return -2;
} }
} }
@ -1424,7 +1424,7 @@ int cmake::ActualConfigure()
message += *instance; message += *instance;
message += "\nEither remove the CMakeCache.txt file and CMakeFiles " message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory."; "directory or choose a different binary directory.";
cmSystemTools::Error(message.c_str()); cmSystemTools::Error(message);
return -2; return -2;
} }
} else { } else {
@ -1443,7 +1443,7 @@ int cmake::ActualConfigure()
message += *platformName; message += *platformName;
message += "\nEither remove the CMakeCache.txt file and CMakeFiles " message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory."; "directory or choose a different binary directory.";
cmSystemTools::Error(message.c_str()); cmSystemTools::Error(message);
return -2; return -2;
} }
} else { } else {
@ -1461,7 +1461,7 @@ int cmake::ActualConfigure()
message += *tsName; message += *tsName;
message += "\nEither remove the CMakeCache.txt file and CMakeFiles " message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory."; "directory or choose a different binary directory.";
cmSystemTools::Error(message.c_str()); cmSystemTools::Error(message);
return -2; return -2;
} }
} else { } else {

View File

@ -123,7 +123,7 @@ void CMakeCommandUsage(const char* program)
; ;
/* clang-format on */ /* clang-format on */
cmSystemTools::Error(errorStream.str().c_str()); cmSystemTools::Error(errorStream.str());
} }
static bool cmTarFilesFrom(std::string const& file, static bool cmTarFilesFrom(std::string const& file,
@ -132,14 +132,14 @@ static bool cmTarFilesFrom(std::string const& file,
if (cmSystemTools::FileIsDirectory(file)) { if (cmSystemTools::FileIsDirectory(file)) {
std::ostringstream e; std::ostringstream e;
e << "-E tar --files-from= file '" << file << "' is a directory"; e << "-E tar --files-from= file '" << file << "' is a directory";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return false; return false;
} }
cmsys::ifstream fin(file.c_str()); cmsys::ifstream fin(file.c_str());
if (!fin) { if (!fin) {
std::ostringstream e; std::ostringstream e;
e << "-E tar --files-from= file '" << file << "' not found"; e << "-E tar --files-from= file '" << file << "' not found";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return false; return false;
} }
std::string line; std::string line;
@ -153,7 +153,7 @@ static bool cmTarFilesFrom(std::string const& file,
std::ostringstream e; std::ostringstream e;
e << "-E tar --files-from='" << file << "' file invalid line:\n" e << "-E tar --files-from='" << file << "' file invalid line:\n"
<< line << "\n"; << line << "\n";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str());
return false; return false;
} else { } else {
files.push_back(line); files.push_back(line);
@ -1173,7 +1173,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if (server.Serve(&errorMessage)) { if (server.Serve(&errorMessage)) {
return 0; return 0;
} }
cmSystemTools::Error(errorMessage.c_str()); cmSystemTools::Error(errorMessage);
#else #else
static_cast<void>(supportExperimental); static_cast<void>(supportExperimental);
static_cast<void>(isDebug); static_cast<void>(isDebug);