summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CPack/cmCPackGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackGenerator.h2
-rw-r--r--Source/CPack/cpack.cxx2
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx9
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx11
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx14
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h2
-rw-r--r--Source/QtDialog/QCMake.cxx8
-rw-r--r--Source/QtDialog/QCMake.h2
-rw-r--r--Source/cmFileCommand.cxx10
-rw-r--r--Source/cmFindPackageCommand.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx2
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmMakefile.h2
-rw-r--r--Source/cmMessageCommand.cxx2
-rw-r--r--Source/cmServer.cxx4
-rw-r--r--Source/cmServer.h2
-rw-r--r--Source/cmake.cxx6
-rw-r--r--Source/cmake.h4
-rw-r--r--Source/cmakemain.cxx13
22 files changed, 58 insertions, 50 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index b4c05ab..2917763 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -43,7 +43,8 @@ cmCPackGenerator::~cmCPackGenerator()
this->MakefileMap = nullptr;
}
-void cmCPackGenerator::DisplayVerboseOutput(const char* msg, float progress)
+void cmCPackGenerator::DisplayVerboseOutput(const std::string& msg,
+ float progress)
{
(void)progress;
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "" << msg << std::endl);
@@ -689,7 +690,7 @@ int cmCPackGenerator::InstallCMakeProject(
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cm.AddCMakePaths();
- cm.SetProgressCallback([this](const char* msg, float prog) {
+ cm.SetProgressCallback([this](const std::string& msg, float prog) {
this->DisplayVerboseOutput(msg, prog);
});
cm.SetTrace(this->Trace);
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 4755f94..9e4bf43 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -96,7 +96,7 @@ public:
void SetLogger(cmCPackLog* log) { this->Logger = log; }
//! Display verbose information via logger
- void DisplayVerboseOutput(const char* msg, float progress);
+ void DisplayVerboseOutput(const std::string& msg, float progress);
bool ReadListFile(const char* moduleName);
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 0413422..da9575b 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -90,7 +90,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
return 1;
}
-static void cpackProgressCallback(const char* message, float /*unused*/)
+static void cpackProgressCallback(const std::string& message, float /*unused*/)
{
std::cout << "-- " << message << std::endl;
}
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 3856569..696b52f 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -126,10 +126,11 @@ public:
cmSystemTools::SetStdoutCallback([&s](std::string const& m) { s += m; });
cmSystemTools::SetStderrCallback([&s](std::string const& m) { s += m; });
- this->CM.SetProgressCallback([&s](const char* msg, float /*unused*/) {
- s += msg;
- s += "\n";
- });
+ this->CM.SetProgressCallback(
+ [&s](const std::string& msg, float /*unused*/) {
+ s += msg;
+ s += "\n";
+ });
}
~cmCTestBuildAndTestCaptureRAII()
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 2cbdc4e..a714abe 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -288,11 +288,12 @@ void cmCTestScriptHandler::CreateCMake()
this->ParentMakefile->GetRecursionDepth());
}
- this->CMake->SetProgressCallback([this](const char* m, float /*unused*/) {
- if (m && *m) {
- cmCTestLog(this->CTest, HANDLER_OUTPUT, "-- " << m << std::endl);
- }
- });
+ this->CMake->SetProgressCallback(
+ [this](const std::string& m, float /*unused*/) {
+ if (!m.empty()) {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "-- " << m << std::endl);
+ }
+ });
this->AddCTestCommand("ctest_build", new cmCTestBuildCommand);
this->AddCTestCommand("ctest_configure", new cmCTestConfigureCommand);
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 076ee3d..ec18ece 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -501,14 +501,14 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
pos_form_cursor(this->Form);
}
-void cmCursesMainForm::UpdateProgress(const char* msg, float prog)
+void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog)
{
char tmp[1024];
const char* cmsg = tmp;
if (prog >= 0) {
- sprintf(tmp, "%s %i%%", msg, static_cast<int>(100 * prog));
+ sprintf(tmp, "%s %i%%", msg.c_str(), static_cast<int>(100 * prog));
} else {
- cmsg = msg;
+ cmsg = msg.c_str();
}
this->UpdateStatusBar(cmsg);
this->PrintKeys(1);
@@ -528,7 +528,9 @@ int cmCursesMainForm::Configure(int noconfigure)
touchwin(stdscr);
refresh();
this->CMakeInstance->SetProgressCallback(
- [this](const char* msg, float prog) { this->UpdateProgress(msg, prog); });
+ [this](const std::string& msg, float prog) {
+ this->UpdateProgress(msg, prog);
+ });
// always save the current gui values to disk
this->FillCacheManagerFromUI();
@@ -598,7 +600,9 @@ int cmCursesMainForm::Generate()
touchwin(stdscr);
refresh();
this->CMakeInstance->SetProgressCallback(
- [this](const char* msg, float prog) { this->UpdateProgress(msg, prog); });
+ [this](const std::string& msg, float prog) {
+ this->UpdateProgress(msg, prog);
+ });
// Get rid of previous errors
this->Errors = std::vector<std::string>();
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index c09ce2a..d379975 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -102,7 +102,7 @@ public:
/**
* Progress callback
*/
- void UpdateProgress(const char* msg, float prog);
+ void UpdateProgress(const std::string& msg, float prog);
protected:
// Copy the cache values from the user interface to the actual
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index c90c142..f357f90 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -37,7 +37,7 @@ QCMake::QCMake(QObject* p)
this->CMakeInstance->SetCMakeEditCommand(
cmSystemTools::GetCMakeGUICommand());
this->CMakeInstance->SetProgressCallback(
- [this](const char* msg, float percent) {
+ [this](const std::string& msg, float percent) {
this->progressCallback(msg, percent);
});
@@ -346,12 +346,12 @@ bool QCMake::interruptCallback()
#endif
}
-void QCMake::progressCallback(const char* msg, float percent)
+void QCMake::progressCallback(const std::string& msg, float percent)
{
if (percent >= 0) {
- emit this->progressChanged(QString::fromLocal8Bit(msg), percent);
+ emit this->progressChanged(QString::fromStdString(msg), percent);
} else {
- emit this->outputMessage(QString::fromLocal8Bit(msg));
+ emit this->outputMessage(QString::fromStdString(msg));
}
QCoreApplication::processEvents();
}
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index 8492606..f2fd6d9 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -168,7 +168,7 @@ protected:
cmake* CMakeInstance;
bool interruptCallback();
- void progressCallback(const char* msg, float percent);
+ void progressCallback(std::string const& msg, float percent);
void messageCallback(std::string const& msg, const char* title);
void stdoutCallback(std::string const& msg);
void stderrCallback(std::string const& msg);
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index fb3a1bc..4d9f657 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1834,7 +1834,7 @@ protected:
if (!this->MessageNever && (copy || !this->MessageLazy)) {
std::string message = (copy ? "Installing: " : "Up-to-date: ");
message += toFile;
- this->Makefile->DisplayStatus(message.c_str(), -1);
+ this->Makefile->DisplayStatus(message, -1);
}
if (type != TypeDir) {
// Add the file to the manifest.
@@ -2214,7 +2214,7 @@ bool cmFileCommand::HandleRPathChangeCommand(
message += "\" to \"";
message += newRPath;
message += "\"";
- this->Makefile->DisplayStatus(message.c_str(), -1);
+ this->Makefile->DisplayStatus(message, -1);
}
if (have_ft) {
cmSystemTools::FileTimeSet(file, ft);
@@ -2278,7 +2278,7 @@ bool cmFileCommand::HandleRPathRemoveCommand(
std::string message = "Removed runtime path from \"";
message += file;
message += "\"";
- this->Makefile->DisplayStatus(message.c_str(), -1);
+ this->Makefile->DisplayStatus(message, -1);
}
if (have_ft) {
cmSystemTools::FileTimeSet(file, ft);
@@ -2647,7 +2647,7 @@ int cmFileDownloadProgressCallback(void* clientp, double dltotal, double dlnow,
if (helper->UpdatePercentage(dlnow, dltotal, status)) {
cmFileCommand* fc = helper->GetFileCommand();
cmMakefile* mf = fc->GetMakefile();
- mf->DisplayStatus(status.c_str(), -1);
+ mf->DisplayStatus(status, -1);
}
return 0;
@@ -2665,7 +2665,7 @@ int cmFileUploadProgressCallback(void* clientp, double dltotal, double dlnow,
if (helper->UpdatePercentage(ulnow, ultotal, status)) {
cmFileCommand* fc = helper->GetFileCommand();
cmMakefile* mf = fc->GetMakefile();
- mf->DisplayStatus(status.c_str(), -1);
+ mf->DisplayStatus(status, -1);
}
return 0;
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 52ff5ea..45b096f 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -911,7 +911,7 @@ bool cmFindPackageCommand::HandlePackageMode()
std::ostringstream aw;
aw << "Could NOT find " << this->Name << " (missing: " << this->Name
<< "_DIR)";
- this->Makefile->DisplayStatus(aw.str().c_str(), -1);
+ this->Makefile->DisplayStatus(aw.str(), -1);
}
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 8e7ca12..11c382f 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1225,7 +1225,7 @@ void cmGlobalGenerator::Configure()
} else {
msg << "Configuring done";
}
- this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1);
+ this->CMakeInstance->UpdateProgress(msg.str(), -1);
}
}
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 7284f0b..f872de5 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1006,7 +1006,7 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
winSDK_7_1)) {
std::ostringstream m;
m << "Found Windows SDK v7.1: " << winSDK_7_1;
- mf->DisplayStatus(m.str().c_str(), -1);
+ mf->DisplayStatus(m.str(), -1);
this->DefaultPlatformToolset = "Windows7.1SDK";
return true;
} else {
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index a0a9558..2d54c33 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -171,7 +171,7 @@ bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf,
std::ostringstream e;
e << "Selecting Windows SDK version " << this->WindowsTargetPlatformVersion
<< " to target Windows " << this->SystemVersion << ".";
- mf->DisplayStatus(e.str().c_str(), -1);
+ mf->DisplayStatus(e.str(), -1);
}
mf->AddDefinition("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION",
this->WindowsTargetPlatformVersion.c_str());
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index f246da2..b0dacf1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3547,7 +3547,7 @@ cmState* cmMakefile::GetState() const
return this->GetCMakeInstance()->GetState();
}
-void cmMakefile::DisplayStatus(const char* message, float s) const
+void cmMakefile::DisplayStatus(const std::string& message, float s) const
{
cmake* cm = this->GetCMakeInstance();
if (cm->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) {
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index fce90f2..9f01986 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -639,7 +639,7 @@ public:
#endif
///! Display progress or status message.
- void DisplayStatus(const char*, float) const;
+ void DisplayStatus(const std::string&, float) const;
/**
* Expand the given list file arguments into the full set after
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 95f5fcb..1a21ae4 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -68,7 +68,7 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
m->DisplayMessage(type, message, this->Makefile->GetBacktrace());
} else {
if (status) {
- this->Makefile->DisplayStatus(message.c_str(), -1);
+ this->Makefile->DisplayStatus(message, -1);
} else {
cmSystemTools::Message(message);
}
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 719e6b1..1903fd9 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -103,7 +103,7 @@ void cmServer::ProcessRequest(cmConnection* connection,
if (this->Protocol) {
this->Protocol->CMakeInstance()->SetProgressCallback(
- [&request](const char* msg, float prog) {
+ [&request](const std::string& msg, float prog) {
reportProgress(msg, prog, request);
});
this->WriteResponse(connection, this->Protocol->Process(request),
@@ -155,7 +155,7 @@ void cmServer::PrintHello(cmConnection* connection) const
this->WriteJsonObject(connection, hello, nullptr);
}
-void cmServer::reportProgress(const char* msg, float progress,
+void cmServer::reportProgress(const std::string& msg, float progress,
const cmServerRequest& request)
{
if (progress < 0.0f || progress > 1.0f) {
diff --git a/Source/cmServer.h b/Source/cmServer.h
index 3edc887..aba4924 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -119,7 +119,7 @@ public:
void OnConnected(cmConnection* connection) override;
private:
- static void reportProgress(const char* msg, float progress,
+ static void reportProgress(const std::string& msg, float progress,
const cmServerRequest& request);
static void reportMessage(const std::string& msg, const char* title,
const cmServerRequest& request);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 8023298..d507484 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1705,7 +1705,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
ret = this->Generate();
std::string message = "Build files have been written to: ";
message += this->GetHomeOutputDirectory();
- this->UpdateProgress(message.c_str(), -1);
+ this->UpdateProgress(message, -1);
return ret;
}
@@ -1925,7 +1925,7 @@ void cmake::SetProgressCallback(ProgressCallbackType f)
this->ProgressCallback = std::move(f);
}
-void cmake::UpdateProgress(const char* msg, float prog)
+void cmake::UpdateProgress(const std::string& msg, float prog)
{
if (this->ProgressCallback && !this->State->GetIsInTryCompile()) {
this->ProgressCallback(msg, prog);
@@ -2640,7 +2640,7 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target,
}
std::string message = "Build files have been written to: ";
message += this->GetHomeOutputDirectory();
- this->UpdateProgress(message.c_str(), -1);
+ this->UpdateProgress(message, -1);
// Restore the previously set directories to their original value.
this->SetHomeDirectory(homeOrig);
diff --git a/Source/cmake.h b/Source/cmake.h
index 53d44f1..6fa2d3a 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -273,7 +273,7 @@ public:
///! Parse command line arguments that might set cache values
bool SetCacheArgs(const std::vector<std::string>&);
- using ProgressCallbackType = std::function<void(const char*, float)>;
+ using ProgressCallbackType = std::function<void(const std::string&, float)>;
/**
* Set the function used by GUIs to receive progress updates
* Function gets passed: message as a const char*, a progress
@@ -284,7 +284,7 @@ public:
void SetProgressCallback(ProgressCallbackType f);
///! this is called by generators to update the progress
- void UpdateProgress(const char* msg, float prog);
+ void UpdateProgress(const std::string& msg, float prog);
#if defined(CMAKE_BUILD_WITH_CMAKE)
///! Get the variable watch object
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index a49246b..09068f8 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -148,14 +148,15 @@ static void cmakemainMessageCallback(const std::string& m,
std::cerr << m << cmakemainGetStack(cm) << std::endl << std::flush;
}
-static void cmakemainProgressCallback(const char* m, float prog, cmake* cm)
+static void cmakemainProgressCallback(const std::string& m, float prog,
+ cmake* cm)
{
cmMakefile* mf = cmakemainGetMakefile(cm);
std::string dir;
- if ((mf) && (strstr(m, "Configuring") == m) && (prog < 0)) {
+ if (mf && cmHasLiteralPrefix(m, "Configuring") && (prog < 0)) {
dir = " ";
dir += mf->GetCurrentSourceDirectory();
- } else if ((mf) && (strstr(m, "Generating") == m)) {
+ } else if (mf && cmHasLiteralPrefix(m, "Generating")) {
dir = " ";
dir += mf->GetCurrentBinaryDirectory();
}
@@ -323,7 +324,7 @@ int do_cmake(int ac, char const* const* av)
[&cm](const std::string& msg, const char* title) {
cmakemainMessageCallback(msg, title, &cm);
});
- cm.SetProgressCallback([&cm](const char* msg, float prog) {
+ cm.SetProgressCallback([&cm](const std::string& msg, float prog) {
cmakemainProgressCallback(msg, prog, &cm);
});
cm.SetWorkingMode(workingMode);
@@ -504,7 +505,7 @@ static int do_build(int ac, char const* const* av)
[&cm](const std::string& msg, const char* title) {
cmakemainMessageCallback(msg, title, &cm);
});
- cm.SetProgressCallback([&cm](const char* msg, float prog) {
+ cm.SetProgressCallback([&cm](const std::string& msg, float prog) {
cmakemainProgressCallback(msg, prog, &cm);
});
return cm.Build(jobs, dir, target, config, nativeOptions, clean, verbose);
@@ -547,7 +548,7 @@ static int do_open(int ac, char const* const* av)
[&cm](const std::string& msg, const char* title) {
cmakemainMessageCallback(msg, title, &cm);
});
- cm.SetProgressCallback([&cm](const char* msg, float prog) {
+ cm.SetProgressCallback([&cm](const std::string& msg, float prog) {
cmakemainProgressCallback(msg, prog, &cm);
});
return cm.Open(dir, false) ? 0 : 1;