diff options
author | Brad King <brad.king@kitware.com> | 2019-01-25 12:58:15 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-25 12:59:11 (GMT) |
commit | 9f84cbd8c323a5a59b666a8bc8199e52a181bb35 (patch) | |
tree | 238b6023b3df2c29e2160c373df263669e954fd8 /Source | |
parent | 5a6e683a32c8ba9f7610e4ca0c6c3d9e7888d934 (diff) | |
parent | 99337d345ba9d3379135c90854be23403fa8e274 (diff) | |
download | CMake-9f84cbd8c323a5a59b666a8bc8199e52a181bb35.zip CMake-9f84cbd8c323a5a59b666a8bc8199e52a181bb35.tar.gz CMake-9f84cbd8c323a5a59b666a8bc8199e52a181bb35.tar.bz2 |
Merge topic 'error-overloads'
99337d345b cmSystemTools::Error(): new overload accepting std::string
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2845
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCPluginAPI.cxx | 2 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 2 | ||||
-rw-r--r-- | Source/cmCacheManager.cxx | 4 | ||||
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 2 | ||||
-rw-r--r-- | Source/cmComputeTargetDepends.cxx | 2 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmExportInstallFileGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 8 | ||||
-rw-r--r-- | Source/cmGlobVerificationManager.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio71Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmInstallExportGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmOutputRequiredFilesCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 12 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 19 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 1 | ||||
-rw-r--r-- | Source/cmTryRunCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmVariableRequiresCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmVariableWatchCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmake.cxx | 12 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 10 |
23 files changed, 62 insertions, 54 deletions
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 8ed43f9..811af56 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -720,7 +720,7 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir, ext != headerExts.end(); ++ext) { e << " ." << *ext; } - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); } void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir, diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 4e2f275..989c7ee 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2173,7 +2173,7 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output) // handle the simple commandline arguments std::string errormsg; if (!this->HandleCommandLineArguments(i, args, errormsg)) { - cmSystemTools::Error(errormsg.c_str()); + cmSystemTools::Error(errormsg); return 1; } diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index e1d312b..a133914 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -123,7 +123,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, std::ostringstream error; error << "Parse error in cache file " << cacheFile; error << " on line " << lineno << ". Offending entry: " << realbuffer; - cmSystemTools::Error(error.str().c_str()); + cmSystemTools::Error(error.str()); } } this->CacheMajorVersion = 0; @@ -171,7 +171,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, << " where CMakeCache.txt was created. This may result " "in binaries being created in the wrong place. If you " "are not sure, reedit the CMakeCache.txt"; - cmSystemTools::Error(message.str().c_str()); + cmSystemTools::Error(message.str()); } } return true; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 87bc150..c68bb21 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1237,7 +1237,7 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) std::ostringstream e; e << "Could not parse framework path \"" << item << "\" " << "linked by target " << this->Target->GetName() << "."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return; } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index fde9750..1d20cff 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -495,7 +495,7 @@ void cmComputeTargetDepends::ComplainAboutBadComponent( e << "At least one of these targets is not a STATIC_LIBRARY. " << "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, diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index c6b66a3..c8f743a 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -83,7 +83,7 @@ bool cmExportFileGenerator::GenerateImportFile() std::string se = cmSystemTools::GetLastSystemError(); std::ostringstream e; e << "cannot write to file \"" << this->MainImportFile << "\": " << se; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } std::ostream& os = *foutPtr; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 3821144..f8bc0ab 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -54,7 +54,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) << "\" ...) " << "includes target \"" << te->Target->GetName() << "\" more than once in the export set."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } } @@ -112,7 +112,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) std::string errorMessage; if (!this->PopulateExportProperties(gt, properties, errorMessage)) { - cmSystemTools::Error(errorMessage.c_str()); + cmSystemTools::Error(errorMessage); return false; } @@ -294,7 +294,7 @@ bool cmExportInstallFileGenerator::GenerateImportFileConfig( std::string se = cmSystemTools::GetLastSystemError(); std::ostringstream e; e << "cannot write to file \"" << fileName << "\": " << se; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } std::ostream& os = exportFileStream; @@ -518,7 +518,7 @@ void cmExportInstallFileGenerator::ComplainAboutMissingTarget( e << "that is not in this export set, but " << occurrences << " times in others."; } - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); } std::string cmExportInstallFileGenerator::InstallNameDir( diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 0e3ace3..e028d8d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -203,7 +203,7 @@ std::string cmGeneratorTarget::GetExportName() const std::ostringstream e; e << "EXPORT_NAME property \"" << exportName << "\" for \"" << this->GetName() << "\": is not valid."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return ""; } return exportName; @@ -4587,7 +4587,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, << " property requirement\nof " "dependency \"" << theTarget->GetName() << "\".\n"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); break; } propContent = consistent.second; @@ -4612,7 +4612,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, "already. The INTERFACE_" << p << " property on\ndependency \"" << theTarget->GetName() << "\" is in conflict.\n"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); break; } propContent = consistent.second; @@ -4632,7 +4632,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, e << "The INTERFACE_" << p << " property of \"" << theTarget->GetName() << "\" does\nnot agree with the value of " << p << " already determined\nfor \"" << tgt->GetName() << "\".\n"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); break; } propContent = consistent.second; diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx index e8959f2..478f725 100644 --- a/Source/cmGlobVerificationManager.cxx +++ b/Source/cmGlobVerificationManager.cxx @@ -165,7 +165,7 @@ void cmGlobVerificationManager::AddCacheEntry( message << "\n " << std::get<0>(bt); std::get<1>(bt).PrintTitle(message); } - cmSystemTools::Error(message.str().c_str()); + cmSystemTools::Error(message.str()); } else { value.Backtraces.emplace_back(variable, backtrace); } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b2b0e38..ca96ebc 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -364,7 +364,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) err << "CMake was unable to find a build program corresponding to \"" << this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You " << "probably need to select a different build tool."; - cmSystemTools::Error(err.str().c_str()); + cmSystemTools::Error(err.str()); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -1282,7 +1282,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const << "duplicate custom targets. " << "Consider using a Makefiles generator or fix the project to not " << "use duplicate target names."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 557efec..7963c8a 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -93,7 +93,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, message += prevTool; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return false; } else { /* 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()) { std::string msg = "No GHS toolsets found in GHS_TOOLSET_ROOT \"" + tsd + "\"."; - cmSystemTools::Error(msg.c_str()); + cmSystemTools::Error(msg); tsd = ""; } else { tsd += output.back(); @@ -189,7 +189,7 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd, tryPath = cmSystemTools::CollapseCombinedPath(tsd, ts); if (!cmSystemTools::FileExists(tryPath)) { std::string msg = "GHS toolset \"" + tryPath + "\" not found."; - cmSystemTools::Error(msg.c_str()); + cmSystemTools::Error(msg); tsd = ""; } else { tsd = tryPath; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 16796cf..8e67fad 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -149,7 +149,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends( m += target->GetName(); m += " depends on unknown target: "; m += name; - cmSystemTools::Error(m.c_str()); + cmSystemTools::Error(m); } fout << "\t\t{" << guid << "} = {" << guid << "}\n"; } diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 4cc081c..98a895e 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -127,7 +127,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os) std::ostringstream e; e << "INSTALL(EXPORT) given unknown export \"" << ExportSet->GetName() << "\""; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 3771737..62aff99 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1794,7 +1794,7 @@ static void AddVisibilityCompileOption(std::string& flags, std::ostringstream e; e << "Target " << target->GetName() << " uses unsupported value \"" << prop << "\" for " << flagDefine << "."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return; } std::string option = std::string(opt) + prop; @@ -2800,7 +2800,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target, std::ostringstream e; e << "Target " << target->GetName() << " Info.plist template \"" << inFile << "\" could not be found."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return; } @@ -2838,7 +2838,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList( std::ostringstream e; e << "Target " << target->GetName() << " Info.plist template \"" << inFile << "\" could not be found."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return; } diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index ab1e699..ff1e027 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -194,7 +194,7 @@ protected: message += includeFile; message += " for file "; message += info->FullPath; - cmSystemTools::Error(message.c_str(), nullptr); + cmSystemTools::Error(message); } continue; } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 47f7d73..d37e5f5 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -111,7 +111,7 @@ static bool AddToSourceGroup(cmMakefile* makefile, std::string const& fileName, ost << ": " << property; ost << ": Could not find or create the source group "; ost << cmQtAutoGen::Quoted(groupName); - cmSystemTools::Error(ost.str().c_str()); + cmSystemTools::Error(ost.str()); return false; } } @@ -941,7 +941,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() if (!qrc.Generated) { std::string error; if (!RccListInputs(qrc.QrcFile, qrc.Resources, error)) { - cmSystemTools::Error(error.c_str()); + cmSystemTools::Error(error); return false; } } @@ -1219,7 +1219,7 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() if (!cmSystemTools::MakeDirectory(this->Dir.Info)) { std::string emsg = ("AutoGen: Could not create directory: "); emsg += Quoted(this->Dir.Info); - cmSystemTools::Error(emsg.c_str()); + cmSystemTools::Error(emsg); return false; } @@ -1307,7 +1307,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() } else { std::string err = "AutoGen: Could not write file "; err += this->AutogenTarget.InfoFile; - cmSystemTools::Error(err.c_str()); + cmSystemTools::Error(err); return false; } @@ -1347,7 +1347,7 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo() } else { std::string err = "AutoRcc: Could not write file "; err += qrc.InfoFile; - cmSystemTools::Error(err.c_str()); + cmSystemTools::Error(err); return false; } } @@ -1512,7 +1512,7 @@ std::pair<bool, std::string> GetQtExecutable( msg += target->GetName(); msg += "): "; msg += err; - cmSystemTools::Error(msg.c_str()); + cmSystemTools::Error(msg); return std::make_pair(false, ""); } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 9abc5f3..2d98a7d 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -270,6 +270,13 @@ void cmSystemTools::Error(const char* m1, const char* m2, const char* m3, 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) { s_InterruptCallback = f; @@ -338,7 +345,7 @@ void cmSystemTools::ReportLastSystemError(const char* msg) std::string m = msg; m += ": System Error: "; m += Superclass::GetLastSystemError(); - cmSystemTools::Error(m.c_str()); + cmSystemTools::Error(m); } bool cmSystemTools::IsInternallyOn(const char* val) @@ -549,7 +556,7 @@ std::vector<std::string> cmSystemTools::HandleResponseFile( error += cmSystemTools::GetLastSystemError(); error += "):\n "; error += arg.substr(1); - cmSystemTools::Error(error.c_str()); + cmSystemTools::Error(error); } else { std::string line; cmSystemTools::GetLineFromStream(responseFile, line); @@ -1651,7 +1658,7 @@ bool cmSystemTools::CreateTar(const char* outFileName, e += outFileName; e += "\": "; e += cmSystemTools::GetLastSystemError(); - cmSystemTools::Error(e.c_str()); + cmSystemTools::Error(e); return false; } cmArchiveWrite::Compress compress = cmArchiveWrite::CompressNone; @@ -1684,7 +1691,7 @@ bool cmSystemTools::CreateTar(const char* outFileName, } } if (!a) { - cmSystemTools::Error(a.GetError().c_str()); + cmSystemTools::Error(a.GetError()); return false; } return true; @@ -3120,7 +3127,7 @@ bool cmSystemTools::CreateSymlink(const std::string& origName, if (errorMessage) { *errorMessage = std::move(e); } else { - cmSystemTools::Error(e.c_str()); + cmSystemTools::Error(e); } return false; } @@ -3141,7 +3148,7 @@ bool cmSystemTools::CreateLink(const std::string& origName, if (errorMessage) { *errorMessage = std::move(e); } else { - cmSystemTools::Error(e.c_str()); + cmSystemTools::Error(e); } return false; } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 7a209c6..9d872d1 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -70,6 +70,7 @@ public: */ static void Error(const char* m, const char* m2 = nullptr, const char* m3 = nullptr, const char* m4 = nullptr); + static void Error(const std::string& m); /** * Display a message. diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 10a6d9a..0a657f7 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -121,7 +121,7 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv, // now try running the command if it compiled if (!res) { if (this->OutputFile.empty()) { - cmSystemTools::Error(this->FindErrorMessage.c_str()); + cmSystemTools::Error(this->FindErrorMessage); } else { // "run" it and capture the output std::string runOutputContents; @@ -354,7 +354,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, errorMessage += " " + internalRunOutputName + " (advanced)\n"; } errorMessage += detailsString; - cmSystemTools::Error(errorMessage.c_str()); + cmSystemTools::Error(errorMessage); return; } diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index 06ca53c..c02157a 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -57,7 +57,7 @@ bool cmVariableRequiresCommand::InitialPass( "One or more of the required variables is advanced." " To set the variable, you must turn on advanced mode in cmake."; } - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); } return true; diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 03e0059..975d6e4 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -60,7 +60,7 @@ static void cmVariableWatchCommandVariableAccessed(const std::string& variable, error << "Error in cmake code at\nUnknown:0:\n" << "A command failed during the invocation of callback \"" << data->Command << "\"."; - cmSystemTools::Error(error.str().c_str()); + cmSystemTools::Error(error.str()); data->InCallback = false; return; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 914c3b0..1261fff 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1172,7 +1172,7 @@ int cmake::DoPreConfigureChecks() } err << "Specify --help for usage, or press the help button on the CMake " "GUI."; - cmSystemTools::Error(err.str().c_str()); + cmSystemTools::Error(err.str()); return -2; } @@ -1190,7 +1190,7 @@ int cmake::DoPreConfigureChecks() message += cacheStart; message += "\" used to generate cache. "; message += "Re-run cmake with a different source directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return -2; } } else { @@ -1400,7 +1400,7 @@ int cmake::ActualConfigure() message += *genName; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return -2; } } @@ -1424,7 +1424,7 @@ int cmake::ActualConfigure() message += *instance; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return -2; } } else { @@ -1443,7 +1443,7 @@ int cmake::ActualConfigure() message += *platformName; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return -2; } } else { @@ -1461,7 +1461,7 @@ int cmake::ActualConfigure() message += *tsName; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return -2; } } else { diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index cb59034..f5769f6 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -123,7 +123,7 @@ void CMakeCommandUsage(const char* program) ; /* clang-format on */ - cmSystemTools::Error(errorStream.str().c_str()); + cmSystemTools::Error(errorStream.str()); } static bool cmTarFilesFrom(std::string const& file, @@ -132,14 +132,14 @@ static bool cmTarFilesFrom(std::string const& file, if (cmSystemTools::FileIsDirectory(file)) { std::ostringstream e; e << "-E tar --files-from= file '" << file << "' is a directory"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } cmsys::ifstream fin(file.c_str()); if (!fin) { std::ostringstream e; e << "-E tar --files-from= file '" << file << "' not found"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } std::string line; @@ -153,7 +153,7 @@ static bool cmTarFilesFrom(std::string const& file, std::ostringstream e; e << "-E tar --files-from='" << file << "' file invalid line:\n" << line << "\n"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } else { files.push_back(line); @@ -1172,7 +1172,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) if (server.Serve(&errorMessage)) { return 0; } - cmSystemTools::Error(errorMessage.c_str()); + cmSystemTools::Error(errorMessage); #else static_cast<void>(supportExperimental); static_cast<void>(isDebug); |