[Cmake-commits] CMake branch, master, updated. v3.14.0-rc1-73-g9d2ab63
Kitware Robot
kwrobot at kitware.com
Tue Feb 12 08:33:04 EST 2019
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, master has been updated
via 9d2ab63aaf5fb29d812dbfc942da4d7671c5d1b3 (commit)
via 20afd497c92f66883de5dae92e2105c2f0cb4f70 (commit)
via a7a85719332b5be90bb9ce1f3707a767197566c0 (commit)
via c0ba467d2de9b6af7bd1657c73eb0638f1d2c89c (commit)
via 336300d53003d2ec135d302acfdd1827062a05a6 (commit)
via f468c0e1b98389fde7df2baccdc3815171a47a35 (commit)
via 9e34f11b3604269c8c4f98bbcf237daeca9eaa2c (commit)
via f0a57d42a2b0309c14615b7a9572f611ddda435e (commit)
via a251b61181252eb380d24778cdd8224ea7198eef (commit)
via 572b4fd85b5987858ee6ce6fd7381c3cfd6720e9 (commit)
via 3ff5a43c499c74715a282e782f4191d4420c9c73 (commit)
via 40176749bc2243adb4acc8c53c902f6c349da24b (commit)
via 950c099d83757acd57cec78a3579ea1f6aaddf96 (commit)
via 091afa7342e6c093f404b4777b81313535d73435 (commit)
via 006768903cb6586098218822129d622737848299 (commit)
via d625dfcdf9ad36802d0615cd929dd5c407a46524 (commit)
via 633b3145c0e4d918f53272dab3358867bc252b0b (commit)
via f6291eee251ec4fbc699ee63294057b0bc7016a4 (commit)
via 948c55857e126825ce5f8282857d6970ba14e6bb (commit)
via 6725975bd8c47c7817a286ada9eadb9b0fbf324c (commit)
from 64ae72c52ac44984c9d5a23b19f4bd9dc9a68fdf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9d2ab63aaf5fb29d812dbfc942da4d7671c5d1b3
commit 9d2ab63aaf5fb29d812dbfc942da4d7671c5d1b3
Merge: 20afd49 091afa7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 12 13:28:56 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Feb 12 08:31:00 2019 -0500
Merge topic 'clangcl-fixes'
091afa7342 Tests: Teach tests when to treat clang-cl as MSVC
006768903c Work around clang-cl breakage on make_unique/std::forward
d625dfcdf9 Avoid compiling CMake itself as C++17 with Clang's MSVC ABI
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2573
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20afd497c92f66883de5dae92e2105c2f0cb4f70
commit 20afd497c92f66883de5dae92e2105c2f0cb4f70
Merge: a7a8571 950c099
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 12 13:28:43 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Feb 12 08:30:13 2019 -0500
Merge topic 'progress-stdstring'
950c099d83 cmake: Progress functions use `std::string` param
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2948
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7a85719332b5be90bb9ce1f3707a767197566c0
commit a7a85719332b5be90bb9ce1f3707a767197566c0
Merge: c0ba467 f6291ee
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 12 13:28:32 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Feb 12 08:29:08 2019 -0500
Merge topic 'modernize-cmCursesMainForm'
f6291eee25 cmCursesMainForm: Modernize with STL and ranged-for loops
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2947
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c0ba467d2de9b6af7bd1657c73eb0638f1d2c89c
commit c0ba467d2de9b6af7bd1657c73eb0638f1d2c89c
Merge: 336300d 948c558
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 12 13:28:17 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Feb 12 08:28:24 2019 -0500
Merge topic 'cmCTestRunTest-compress'
948c55857e cmCTestRunTest: Remove duplicated compression logic
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2946
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=336300d53003d2ec135d302acfdd1827062a05a6
commit 336300d53003d2ec135d302acfdd1827062a05a6
Merge: f468c0e a251b61
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 12 08:27:01 2019 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Feb 12 08:27:01 2019 -0500
Merge branch 'release-3.14'
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f468c0e1b98389fde7df2baccdc3815171a47a35
commit f468c0e1b98389fde7df2baccdc3815171a47a35
Merge: 9e34f11 4017674
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 12 13:24:10 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Feb 12 08:25:51 2019 -0500
Merge topic 'FindMatlab-version-empty'
40176749bc FindMatlab: Tolerate empty version log file
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2949
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e34f11b3604269c8c4f98bbcf237daeca9eaa2c
commit 9e34f11b3604269c8c4f98bbcf237daeca9eaa2c
Merge: f0a57d4 572b4fd
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 12 13:24:18 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Feb 12 08:24:59 2019 -0500
Merge topic 'doc-if-legacy'
572b4fd85b Help: Fix elseif/endif typo
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2950
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f0a57d42a2b0309c14615b7a9572f611ddda435e
commit f0a57d42a2b0309c14615b7a9572f611ddda435e
Merge: 64ae72c 6725975
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 12 13:24:03 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Feb 12 08:24:11 2019 -0500
Merge topic 'FindOctave-interp-target'
6725975bd8 FindOctave: Add target for octinterp
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2931
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=950c099d83757acd57cec78a3579ea1f6aaddf96
commit 950c099d83757acd57cec78a3579ea1f6aaddf96
Author: Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Mon Feb 11 10:30:00 2019 -0500
Commit: Vitaly Stakhovsky <vvs31415 at gitlab.org>
CommitDate: Mon Feb 11 10:32:43 2019 -0500
cmake: Progress functions use `std::string` param
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;
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=091afa7342e6c093f404b4777b81313535d73435
commit 091afa7342e6c093f404b4777b81313535d73435
Author: Zsolt Parragi <zsolt.parragi at cancellar.hu>
AuthorDate: Tue Nov 6 20:40:18 2018 +0100
Commit: Zsolt Parragi <zsolt.parragi at cancellar.hu>
CommitDate: Mon Feb 11 15:04:28 2019 +0100
Tests: Teach tests when to treat clang-cl as MSVC
* Disable the system include unused variable test in ExportImport when
clang is in MSVC compatible mode.
* Disable CxxDialect testcase when clang is in MSVC compatible mode, as
it doesn't support `typeof`.
* Teach Module.WriteCompilerDetectionHeader to treat clang-cl as MSVC.
* Disable the SystemIncludeDirectories testcase within
IncludeDirectories when clang is in MSVC compatible mode.
* Disable the CMakeOnly.CheckCXXCompilerFlag testcase when clang is in
MSVC compatible mode.
* Treat clang-cl as MSVC in LinkOptions.cmake in the try_run and
try_compile testcases.
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index e8e5a2c..40e53a2 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -459,7 +459,7 @@ if(BUILD_TESTING)
set(runCxxDialectTest 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang
- AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+ AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4 AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
if(NOT APPLE OR POLICY CMP0025)
set(runCxxDialectTest 1)
endif()
diff --git a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
index 9be69f1..1f9d3ac 100644
--- a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
+++ b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
@@ -57,7 +57,7 @@ else()
message("Unhandled Platform")
endif()
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
check_cxx_compiler_flag("-x c++" HAVE_X_CXX)
if(NOT HAVE_X_CXX)
message(FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed")
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 811fff3..b5df961 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -407,7 +407,7 @@ endforeach()
unset(_configs)
if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
- OR CMAKE_C_COMPILER_ID STREQUAL Clang)
+ OR (CMAKE_C_COMPILER_ID STREQUAL Clang AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"))
AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja"))
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test)
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index b7b8320..761c405 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6)
project(IncludeDirectories)
if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
- OR CMAKE_C_COMPILER_ID STREQUAL Clang OR CMAKE_C_COMPILER_ID STREQUAL AppleClang)
+ OR (CMAKE_C_COMPILER_ID STREQUAL Clang AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") OR CMAKE_C_COMPILER_ID STREQUAL AppleClang)
AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles"
OR CMAKE_GENERATOR STREQUAL "Ninja"
OR (CMAKE_GENERATOR STREQUAL "Xcode" AND NOT XCODE_VERSION VERSION_LESS 6.0)))
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index 45bb229..616092d 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -61,7 +61,7 @@ if (C_expected_features)
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_C_COMPILER_VERSION}")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU"
- OR CMAKE_C_COMPILER_ID STREQUAL "Clang"
+ OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
OR CMAKE_C_COMPILER_ID STREQUAL "Intel")
add_executable(WriteCompilerDetectionHeader_C11 main.c)
@@ -118,7 +118,7 @@ string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINO
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_CXX_COMPILER_VERSION}")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
- OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
+ OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"
OR CMAKE_CXX_COMPILER_ID STREQUAL "SunPro"
OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
@@ -128,7 +128,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
endif()
# for msvc the compiler version determines which c++11 features are available.
-if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
if(";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;")
list(APPEND true_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
list(APPEND true_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
diff --git a/Tests/RunCMake/try_compile/LinkOptions.cmake b/Tests/RunCMake/try_compile/LinkOptions.cmake
index 9b246c4..488cab1 100644
--- a/Tests/RunCMake/try_compile/LinkOptions.cmake
+++ b/Tests/RunCMake/try_compile/LinkOptions.cmake
@@ -5,7 +5,7 @@ cmake_policy(SET CMP0054 NEW)
set (lib_name "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}lib${CMAKE_STATIC_LIBRARY_SUFFIX}")
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
- if (RunCMake_C_COMPILER_ID STREQUAL "MSVC")
+ if (RunCMake_C_COMPILER_ID STREQUAL "MSVC" OR "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set (undef_flag /INCLUDE:_func)
else()
diff --git a/Tests/RunCMake/try_run/LinkOptions.cmake b/Tests/RunCMake/try_run/LinkOptions.cmake
index 17af2f7..9939a42 100644
--- a/Tests/RunCMake/try_run/LinkOptions.cmake
+++ b/Tests/RunCMake/try_run/LinkOptions.cmake
@@ -5,7 +5,7 @@ cmake_policy(SET CMP0054 NEW)
set (lib_name "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}lib${CMAKE_STATIC_LIBRARY_SUFFIX}")
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
- if (RunCMake_C_COMPILER_ID STREQUAL "MSVC")
+ if (RunCMake_C_COMPILER_ID STREQUAL "MSVC" OR "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set (undef_flag /INCLUDE:_func)
else()
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=006768903cb6586098218822129d622737848299
commit 006768903cb6586098218822129d622737848299
Author: Zsolt Parragi <zsolt.parragi at cancellar.hu>
AuthorDate: Tue Nov 6 20:40:18 2018 +0100
Commit: Zsolt Parragi <zsolt.parragi at cancellar.hu>
CommitDate: Mon Feb 11 15:04:28 2019 +0100
Work around clang-cl breakage on make_unique/std::forward
Clang on Windows with the MSVC ABI produces link errors of the
form `unresolved std::_Iosb<int>::{app,_Openmode} in ...`.
Use a temporary variable to forward as lvalue rather than rvalue
to work around the problem.
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index c8f743a..a12e0c4 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -70,8 +70,9 @@ bool cmExportFileGenerator::GenerateImportFile()
std::unique_ptr<cmsys::ofstream> foutPtr;
if (this->AppendMode) {
// Open for append.
+ auto openmodeApp = std::ios::app;
foutPtr = cm::make_unique<cmsys::ofstream>(this->MainImportFile.c_str(),
- std::ios::app);
+ openmodeApp);
} else {
// Generate atomically and with copy-if-different.
std::unique_ptr<cmGeneratedFileStream> ap(
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index b4b2962..e542e50 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -50,8 +50,9 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
// Use copy-if-different if not appending.
std::unique_ptr<cmsys::ofstream> foutPtr;
if (this->Append) {
+ const auto openmodeApp = std::ios::app;
foutPtr =
- cm::make_unique<cmsys::ofstream>(this->Filename.c_str(), std::ios::app);
+ cm::make_unique<cmsys::ofstream>(this->Filename.c_str(), openmodeApp);
} else {
std::unique_ptr<cmGeneratedFileStream> ap(
new cmGeneratedFileStream(this->Filename, true));
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d625dfcdf9ad36802d0615cd929dd5c407a46524
commit d625dfcdf9ad36802d0615cd929dd5c407a46524
Author: Zsolt Parragi <zsolt.parragi at cancellar.hu>
AuthorDate: Tue Nov 6 20:40:18 2018 +0100
Commit: Zsolt Parragi <zsolt.parragi at cancellar.hu>
CommitDate: Mon Feb 11 15:04:19 2019 +0100
Avoid compiling CMake itself as C++17 with Clang's MSVC ABI
GUID functions in ATL cause compilation errors with this compiler.
Add the offending case to our check for C++17 support so that it
is not used by default when it does not work.
diff --git a/Source/Checks/cm_cxx17_check.cpp b/Source/Checks/cm_cxx17_check.cpp
index 4e89184..2de10d6 100644
--- a/Source/Checks/cm_cxx17_check.cpp
+++ b/Source/Checks/cm_cxx17_check.cpp
@@ -2,8 +2,21 @@
#include <memory>
#include <unordered_map>
+#ifdef _MSC_VER
+# include <comdef.h>
+#endif
+
int main()
{
std::unique_ptr<int> u(new int(0));
+
+#ifdef _MSC_VER
+ // clang-cl has problems instantiating this constructor in C++17 mode
+ // error: indirection requires pointer operand ('const _GUID' invalid)
+ // return *_IID;
+ IUnknownPtr ptr{};
+ IDispatchPtr disp(ptr);
+#endif
+
return *u;
}
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6291eee251ec4fbc699ee63294057b0bc7016a4
commit f6291eee251ec4fbc699ee63294057b0bc7016a4
Author: Artur Ryt <artur.ryt at gmail.com>
AuthorDate: Sun Feb 10 19:05:27 2019 +0100
Commit: Artur Ryt <artur.ryt at gmail.com>
CommitDate: Sun Feb 10 19:07:50 2019 +0100
cmCursesMainForm: Modernize with STL and ranged-for loops
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index f6a1a57..a03405c 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -79,18 +79,11 @@ cmCursesMainForm::~cmCursesMainForm()
// See if a cache entry is in the list of entries in the ui.
bool cmCursesMainForm::LookForCacheEntry(const std::string& key)
{
- if (!this->Entries) {
- return false;
- }
-
- std::vector<cmCursesCacheEntryComposite*>::iterator it;
- for (it = this->Entries->begin(); it != this->Entries->end(); ++it) {
- if (key == (*it)->Key) {
- return true;
- }
- }
-
- return false;
+ return this->Entries &&
+ std::any_of(this->Entries->begin(), this->Entries->end(),
+ [&key](cmCursesCacheEntryComposite* entry) {
+ return key == entry->Key;
+ });
}
// Create new cmCursesCacheEntryComposite entries from the cache
@@ -190,13 +183,12 @@ void cmCursesMainForm::RePost()
} else {
// If normal mode, count only non-advanced entries
this->NumberOfVisibleEntries = 0;
- std::vector<cmCursesCacheEntryComposite*>::iterator it;
- for (it = this->Entries->begin(); it != this->Entries->end(); ++it) {
+ for (cmCursesCacheEntryComposite* entry : *this->Entries) {
const char* existingValue =
- this->CMakeInstance->GetState()->GetCacheEntryValue((*it)->GetValue());
+ this->CMakeInstance->GetState()->GetCacheEntryValue(entry->GetValue());
bool advanced =
this->CMakeInstance->GetState()->GetCacheEntryPropertyAsBool(
- (*it)->GetValue(), "ADVANCED");
+ entry->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && advanced)) {
continue;
}
@@ -217,27 +209,26 @@ void cmCursesMainForm::RePost()
// Assign fields
int j = 0;
- std::vector<cmCursesCacheEntryComposite*>::iterator it;
- for (it = this->Entries->begin(); it != this->Entries->end(); ++it) {
+ for (cmCursesCacheEntryComposite* entry : *this->Entries) {
const char* existingValue =
- this->CMakeInstance->GetState()->GetCacheEntryValue((*it)->GetValue());
+ this->CMakeInstance->GetState()->GetCacheEntryValue(entry->GetValue());
bool advanced =
this->CMakeInstance->GetState()->GetCacheEntryPropertyAsBool(
- (*it)->GetValue(), "ADVANCED");
+ entry->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && advanced)) {
continue;
}
- this->Fields[3 * j] = (*it)->Label->Field;
- this->Fields[3 * j + 1] = (*it)->IsNewLabel->Field;
- this->Fields[3 * j + 2] = (*it)->Entry->Field;
+ this->Fields[3 * j] = entry->Label->Field;
+ this->Fields[3 * j + 1] = entry->IsNewLabel->Field;
+ this->Fields[3 * j + 2] = entry->Entry->Field;
j++;
}
// if no cache entries there should still be one dummy field
if (j == 0) {
- it = this->Entries->begin();
- this->Fields[0] = (*it)->Label->Field;
- this->Fields[1] = (*it)->IsNewLabel->Field;
- this->Fields[2] = (*it)->Entry->Field;
+ const auto& front = *this->Entries->front();
+ this->Fields[0] = front.Label->Field;
+ this->Fields[1] = front.IsNewLabel->Field;
+ this->Fields[2] = front.Entry->Field;
this->NumberOfVisibleEntries = 1;
}
// Has to be null terminated.
@@ -278,13 +269,12 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
} else {
// If normal, display only non-advanced entries
this->NumberOfVisibleEntries = 0;
- std::vector<cmCursesCacheEntryComposite*>::iterator it;
- for (it = this->Entries->begin(); it != this->Entries->end(); ++it) {
+ for (cmCursesCacheEntryComposite* entry : *this->Entries) {
const char* existingValue =
- this->CMakeInstance->GetState()->GetCacheEntryValue((*it)->GetValue());
+ this->CMakeInstance->GetState()->GetCacheEntryValue(entry->GetValue());
bool advanced =
this->CMakeInstance->GetState()->GetCacheEntryPropertyAsBool(
- (*it)->GetValue(), "ADVANCED");
+ entry->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && advanced)) {
continue;
}
@@ -297,13 +287,12 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
if (height > 0) {
bool isNewPage;
int i = 0;
- std::vector<cmCursesCacheEntryComposite*>::iterator it;
- for (it = this->Entries->begin(); it != this->Entries->end(); ++it) {
+ for (cmCursesCacheEntryComposite* entry : *this->Entries) {
const char* existingValue =
- this->CMakeInstance->GetState()->GetCacheEntryValue((*it)->GetValue());
+ this->CMakeInstance->GetState()->GetCacheEntryValue(entry->GetValue());
bool advanced =
this->CMakeInstance->GetState()->GetCacheEntryPropertyAsBool(
- (*it)->GetValue(), "ADVANCED");
+ entry->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && advanced)) {
continue;
}
@@ -314,10 +303,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
if (isNewPage) {
this->NumberOfPages++;
}
- (*it)->Label->Move(left, top + row - 1, isNewPage);
- (*it)->IsNewLabel->Move(left + 32, top + row - 1, false);
- (*it)->Entry->Move(left + 33, top + row - 1, false);
- (*it)->Entry->SetPage(this->NumberOfPages);
+ entry->Label->Move(left, top + row - 1, isNewPage);
+ entry->IsNewLabel->Move(left + 32, top + row - 1, false);
+ entry->Entry->Move(left + 33, top + row - 1, false);
+ entry->Entry->SetPage(this->NumberOfPages);
i++;
}
}
@@ -659,28 +648,28 @@ void cmCursesMainForm::RemoveEntry(const char* value)
return;
}
- std::vector<cmCursesCacheEntryComposite*>::iterator it;
- for (it = this->Entries->begin(); it != this->Entries->end(); ++it) {
- const char* val = (*it)->GetValue();
- if (val && !strcmp(value, val)) {
- this->CMakeInstance->UnwatchUnusedCli(value);
- this->Entries->erase(it);
- break;
- }
+ auto removeIt = std::find_if(this->Entries->begin(), this->Entries->end(),
+ [value](cmCursesCacheEntryComposite* entry) {
+ const char* val = entry->GetValue();
+ return val && !strcmp(value, val);
+ });
+
+ if (removeIt != this->Entries->end()) {
+ this->CMakeInstance->UnwatchUnusedCli(value);
+ this->Entries->erase(removeIt);
}
}
// copy from the list box to the cache manager
void cmCursesMainForm::FillCacheManagerFromUI()
{
- size_t size = this->Entries->size();
- for (size_t i = 0; i < size; i++) {
- std::string cacheKey = (*this->Entries)[i]->Key;
+ for (cmCursesCacheEntryComposite* entry : *this->Entries) {
+ const std::string& cacheKey = entry->Key;
const char* existingValue =
this->CMakeInstance->GetState()->GetCacheEntryValue(cacheKey);
if (existingValue) {
std::string oldValue = existingValue;
- std::string newValue = (*this->Entries)[i]->Entry->GetValue();
+ std::string newValue = entry->GetValue();
std::string fixedOldValue;
std::string fixedNewValue;
cmStateEnums::CacheEntryType t =
@@ -976,17 +965,14 @@ void cmCursesMainForm::HandleInput()
if (nextCur) {
// make the next or prev. current field after deletion
- nextCur = nullptr;
- std::vector<cmCursesCacheEntryComposite*>::iterator it;
- for (it = this->Entries->begin(); it != this->Entries->end();
- ++it) {
- if (nextVal == (*it)->Key) {
- nextCur = (*it)->Entry->Field;
- }
- }
-
- if (nextCur) {
- set_current_field(this->Form, nextCur);
+ auto nextEntryIt =
+ std::find_if(this->Entries->begin(), this->Entries->end(),
+ [&nextVal](cmCursesCacheEntryComposite* entry) {
+ return nextVal == entry->Key;
+ });
+
+ if (nextEntryIt != this->Entries->end()) {
+ set_current_field(this->Form, (*nextEntryIt)->Entry->Field);
}
}
}
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=948c55857e126825ce5f8282857d6970ba14e6bb
commit 948c55857e126825ce5f8282857d6970ba14e6bb
Author: Regina Pfeifer <regina at mailbox.org>
AuthorDate: Sun Feb 10 15:47:15 2019 +0100
Commit: Regina Pfeifer <regina at mailbox.org>
CommitDate: Sun Feb 10 15:47:15 2019 +0100
cmCTestRunTest: Remove duplicated compression logic
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 7f081ef..05eb8bd 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -9,8 +9,6 @@
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
-#include "cm_zlib.h"
-#include "cmsys/Base64.h"
#include "cmsys/RegularExpression.hxx"
#include <chrono>
#include <cmAlgorithms.h>
@@ -31,9 +29,6 @@ cmCTestRunTest::cmCTestRunTest(cmCTestMultiProcessHandler& multiHandler)
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
this->TestResult.TestCount = 0;
this->TestResult.Properties = nullptr;
- this->ProcessOutput.clear();
- this->CompressedOutput.clear();
- this->CompressionRatio = 2;
this->NumberOfRunsLeft = 1; // default to 1 run of the test
this->RunUntilFail = false; // default to run the test once
this->RunAgain = false; // default to not having to run again
@@ -68,73 +63,8 @@ void cmCTestRunTest::CheckOutput(std::string const& line)
}
}
-// Streamed compression of test output. The compressed data
-// is appended to this->CompressedOutput
-void cmCTestRunTest::CompressOutput()
-{
- int ret;
- z_stream strm;
-
- unsigned char* in = reinterpret_cast<unsigned char*>(
- const_cast<char*>(this->ProcessOutput.c_str()));
- // zlib makes the guarantee that this is the maximum output size
- int outSize = static_cast<int>(
- static_cast<double>(this->ProcessOutput.size()) * 1.001 + 13.0);
- unsigned char* out = new unsigned char[outSize];
-
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- ret = deflateInit(&strm, -1); // default compression level
- if (ret != Z_OK) {
- delete[] out;
- return;
- }
-
- strm.avail_in = static_cast<uInt>(this->ProcessOutput.size());
- strm.next_in = in;
- strm.avail_out = outSize;
- strm.next_out = out;
- ret = deflate(&strm, Z_FINISH);
-
- if (ret != Z_STREAM_END) {
- cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Error during output compression. Sending uncompressed output."
- << std::endl);
- delete[] out;
- return;
- }
-
- (void)deflateEnd(&strm);
-
- unsigned char* encoded_buffer =
- new unsigned char[static_cast<int>(outSize * 1.5)];
-
- size_t rlen = cmsysBase64_Encode(out, strm.total_out, encoded_buffer, 1);
-
- this->CompressedOutput.clear();
- for (size_t i = 0; i < rlen; i++) {
- this->CompressedOutput += encoded_buffer[i];
- }
-
- if (strm.total_in) {
- this->CompressionRatio =
- static_cast<double>(strm.total_out) / static_cast<double>(strm.total_in);
- }
-
- delete[] encoded_buffer;
- delete[] out;
-}
-
bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
{
- if ((!this->TestHandler->MemCheck &&
- this->CTest->ShouldCompressTestOutput()) ||
- (this->TestHandler->MemCheck &&
- this->CTest->ShouldCompressTestOutput())) {
- this->CompressOutput();
- }
-
this->WriteLogOutputTop(completed, total);
std::string reason;
bool passed = true;
@@ -335,10 +265,18 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
// if the test actually started and ran
// record the results in TestResult
if (started) {
- bool compress = !this->TestHandler->MemCheck &&
- this->CompressionRatio < 1 && this->CTest->ShouldCompressTestOutput();
+ std::string compressedOutput;
+ if (!this->TestHandler->MemCheck &&
+ this->CTest->ShouldCompressTestOutput()) {
+ std::string str = this->ProcessOutput;
+ if (this->CTest->CompressString(str)) {
+ compressedOutput = std::move(str);
+ }
+ }
+ bool compress = !compressedOutput.empty() &&
+ compressedOutput.length() < this->ProcessOutput.length();
this->TestResult.Output =
- compress ? this->CompressedOutput : this->ProcessOutput;
+ compress ? compressedOutput : this->ProcessOutput;
this->TestResult.CompressOutput = compress;
this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
if (!skipped) {
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index 918d5fa..38cc417 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -58,9 +58,6 @@ public:
// Read and store output. Returns true if it must be called again.
void CheckOutput(std::string const& line);
- // Compresses the output, writing to CompressedOutput
- void CompressOutput();
-
// launch the test process, return whether it started correctly
bool StartTest(size_t completed, size_t total);
// capture and report the test results
@@ -105,8 +102,6 @@ private:
cmCTest* CTest;
std::unique_ptr<cmProcess> TestProcess;
std::string ProcessOutput;
- std::string CompressedOutput;
- double CompressionRatio;
// The test results
cmCTestTestHandler::cmCTestTestResult TestResult;
cmCTestMultiProcessHandler& MultiTestHandler;
-----------------------------------------------------------------------
Summary of changes:
Help/command/if.rst | 2 +-
Modules/FindMatlab.cmake | 4 +-
Modules/FindOctave.cmake | 14 ++-
Source/CPack/cmCPackGenerator.cxx | 5 +-
Source/CPack/cmCPackGenerator.h | 2 +-
Source/CPack/cpack.cxx | 2 +-
Source/CTest/cmCTestBuildAndTestHandler.cxx | 9 +-
Source/CTest/cmCTestRunTest.cxx | 84 ++------------
Source/CTest/cmCTestRunTest.h | 5 -
Source/CTest/cmCTestScriptHandler.cxx | 11 +-
Source/Checks/cm_cxx17_check.cpp | 13 +++
Source/CursesDialog/cmCursesMainForm.cxx | 124 ++++++++++-----------
Source/CursesDialog/cmCursesMainForm.h | 2 +-
Source/QtDialog/QCMake.cxx | 8 +-
Source/QtDialog/QCMake.h | 2 +-
Source/cmExportFileGenerator.cxx | 3 +-
Source/cmExportLibraryDependenciesCommand.cxx | 3 +-
Source/cmFileCommand.cxx | 10 +-
Source/cmFindPackageCommand.cxx | 2 +-
Source/cmGlobalGenerator.cxx | 2 +-
Source/cmGlobalVisualStudio10Generator.cxx | 2 +-
Source/cmGlobalVisualStudio14Generator.cxx | 2 +-
Source/cmMakefile.cxx | 2 +-
Source/cmMakefile.h | 2 +-
Source/cmMessageCommand.cxx | 2 +-
Source/cmServer.cxx | 4 +-
Source/cmServer.h | 2 +-
Source/cmake.cxx | 6 +-
Source/cmake.h | 4 +-
Source/cmakemain.cxx | 13 ++-
Tests/CMakeLists.txt | 2 +-
.../CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt | 2 +-
Tests/ExportImport/Import/A/CMakeLists.txt | 2 +-
Tests/FindOctave/Test/CMakeLists.txt | 4 +
Tests/FindOctave/Test/interp_main.cpp | 26 +++++
Tests/IncludeDirectories/CMakeLists.txt | 2 +-
.../WriteCompilerDetectionHeader/CMakeLists.txt | 6 +-
Tests/RunCMake/try_compile/LinkOptions.cmake | 2 +-
Tests/RunCMake/try_run/LinkOptions.cmake | 2 +-
39 files changed, 189 insertions(+), 205 deletions(-)
create mode 100644 Tests/FindOctave/Test/interp_main.cpp
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list