summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx3
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackGenerator.cxx16
-rw-r--r--Source/CPack/cpack.cxx8
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx47
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx15
-rw-r--r--Source/CursesDialog/ccmake.cxx12
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.h7
-rw-r--r--Source/CursesDialog/cmCursesDummyWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesFilePathWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesForm.h5
-rw-r--r--Source/CursesDialog/cmCursesLabelWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.h5
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx22
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h8
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesPathWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesWidget.h5
-rw-r--r--Source/QtDialog/QCMake.cxx50
-rw-r--r--Source/QtDialog/QCMake.h12
-rw-r--r--Source/cmCLocaleEnvironmentScope.h6
-rw-r--r--Source/cmCPackPropertiesGenerator.h6
-rw-r--r--Source/cmCommand.h5
-rw-r--r--Source/cmCommandArgumentParserHelper.h6
-rw-r--r--Source/cmCommandArgumentsHelper.h4
-rw-r--r--Source/cmConfigure.cmake.h.in4
-rw-r--r--Source/cmConnection.h5
-rw-r--r--Source/cmCryptoHash.h5
-rw-r--r--Source/cmDepends.h5
-rw-r--r--Source/cmDependsC.h5
-rw-r--r--Source/cmDependsFortran.h5
-rw-r--r--Source/cmDependsJava.h5
-rw-r--r--Source/cmDynamicLoader.h2
-rw-r--r--Source/cmFileCommand.cxx3
-rw-r--r--Source/cmFileLock.h5
-rw-r--r--Source/cmFileLockPool.h10
-rw-r--r--Source/cmFileMonitor.h4
-rw-r--r--Source/cmFindPackageCommand.cxx9
-rw-r--r--Source/cmFindPackageCommand.h2
-rw-r--r--Source/cmGeneratedFileStream.h5
-rw-r--r--Source/cmGeneratorExpression.h22
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h8
-rw-r--r--Source/cmGeneratorExpressionNode.cxx2
-rw-r--r--Source/cmGeneratorTarget.h5
-rw-r--r--Source/cmGlobalGenerator.cxx10
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx5
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx12
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx7
-rw-r--r--Source/cmInstallCommandArguments.h1
-rw-r--r--Source/cmInstallGenerator.h5
-rw-r--r--Source/cmInstallTargetGenerator.cxx31
-rw-r--r--Source/cmLinkLineComputer.h5
-rw-r--r--Source/cmLinkLineDeviceComputer.h12
-rw-r--r--Source/cmLocale.h6
-rw-r--r--Source/cmMSVC60LinkLineComputer.h6
-rw-r--r--Source/cmMakefile.cxx6
-rw-r--r--Source/cmMakefile.h10
-rw-r--r--Source/cmNinjaLinkLineComputer.h5
-rw-r--r--Source/cmQtAutoGenInitializer.cxx43
-rw-r--r--Source/cmQtAutoGenerator.h4
-rw-r--r--Source/cmQtAutoGeneratorMocUic.cxx3
-rw-r--r--Source/cmQtAutoGeneratorMocUic.h26
-rw-r--r--Source/cmQtAutoGeneratorRcc.cxx5
-rw-r--r--Source/cmQtAutoGeneratorRcc.h4
-rw-r--r--Source/cmScriptGenerator.h5
-rw-r--r--Source/cmServer.cxx26
-rw-r--r--Source/cmServer.h12
-rw-r--r--Source/cmServerProtocol.h5
-rw-r--r--Source/cmSourceFileLocation.h4
-rw-r--r--Source/cmSystemTools.cxx56
-rw-r--r--Source/cmSystemTools.h36
-rw-r--r--Source/cmTestGenerator.h5
-rw-r--r--Source/cmUVHandlePtr.h3
-rw-r--r--Source/cmUseMangledMesaCommand.cxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h8
-rw-r--r--Source/cmXMLWriter.h5
-rw-r--r--Source/cm_thread.hxx12
-rw-r--r--Source/cmake.cxx28
-rw-r--r--Source/cmake.h28
-rw-r--r--Source/cmakemain.cxx43
-rw-r--r--Source/cmcmd.cxx8
-rw-r--r--Source/kwsys/CMakeLists.txt25
-rw-r--r--Source/kwsys/kwsysPlatformTests.cmake5
86 files changed, 493 insertions, 422 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 0362d52..3f37c95 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 13)
-set(CMake_VERSION_PATCH 20190129)
+set(CMake_VERSION_PATCH 20190131)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 24d19d9..01e3ea4 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -286,8 +286,7 @@ protected:
content = cmSystemTools::TrimWhitespace(content);
std::string source = this->basePath + "/" + content;
std::string destination = this->path + "/" + content;
- if (!cmSystemTools::CopyFileIfDifferent(source.data(),
- destination.data())) {
+ if (!cmSystemTools::CopyFileIfDifferent(source, destination)) {
this->hasErrors = true;
}
}
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index 80b9ef3..013ad81 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -210,8 +210,7 @@ int cmCPackDragNDropGenerator::PackageFiles()
bool cmCPackDragNDropGenerator::CopyFile(std::ostringstream& source,
std::ostringstream& target)
{
- if (!cmSystemTools::CopyFileIfDifferent(source.str().c_str(),
- target.str().c_str())) {
+ if (!cmSystemTools::CopyFileIfDifferent(source.str(), target.str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error copying " << source.str() << " to " << target.str()
<< std::endl);
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 4728f69..57c0545 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -43,12 +43,6 @@ cmCPackGenerator::~cmCPackGenerator()
this->MakefileMap = nullptr;
}
-void cmCPackGeneratorProgress(const char* msg, float prog, void* ptr)
-{
- cmCPackGenerator* self = static_cast<cmCPackGenerator*>(ptr);
- self->DisplayVerboseOutput(msg, prog);
-}
-
void cmCPackGenerator::DisplayVerboseOutput(const char* msg, float progress)
{
(void)progress;
@@ -392,8 +386,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
std::move(inFileRelative));
}
/* If it is not a symlink then do a plain copy */
- else if (!(cmSystemTools::CopyFileIfDifferent(inFile.c_str(),
- filePath.c_str()) &&
+ else if (!(cmSystemTools::CopyFileIfDifferent(inFile, filePath) &&
cmSystemTools::CopyFileTime(inFile.c_str(),
filePath.c_str()))) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -696,7 +689,9 @@ int cmCPackGenerator::InstallCMakeProject(
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cm.AddCMakePaths();
- cm.SetProgressCallback(cmCPackGeneratorProgress, this);
+ cm.SetProgressCallback([this](const char* msg, float prog) {
+ this->DisplayVerboseOutput(msg, prog);
+ });
cm.SetTrace(this->Trace);
cm.SetTraceExpand(this->TraceExpand);
cmGlobalGenerator gg(&cm);
@@ -1077,8 +1072,7 @@ int cmCPackGenerator::DoPackage()
<< (tempPackageFileName ? tempPackageFileName : "(NULL)")
<< " to " << (packageFileName ? packageFileName : "(NULL)")
<< std::endl);
- if (!cmSystemTools::CopyFileIfDifferent(tempPackageFileName,
- packageFileName)) {
+ if (!cmSystemTools::CopyFileIfDifferent(pkgFileName, tmpPF)) {
cmCPackLogger(
cmCPackLog::LOG_ERROR,
"Problem copying the package: "
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index d4c867b..0413422 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -90,12 +90,8 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
return 1;
}
-static void cpackProgressCallback(const char* message, float progress,
- void* clientdata)
+static void cpackProgressCallback(const char* message, float /*unused*/)
{
- (void)progress;
- (void)clientdata;
-
std::cout << "-- " << message << std::endl;
}
@@ -212,7 +208,7 @@ int main(int argc, char const* const* argv)
cmake cminst(cmake::RoleScript, cmState::CPack);
cminst.SetHomeDirectory("");
cminst.SetHomeOutputDirectory("");
- cminst.SetProgressCallback(cpackProgressCallback, nullptr);
+ cminst.SetProgressCallback(cpackProgressCallback);
cminst.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator cmgg(&cminst);
cmMakefile globalMF(&cmgg, cminst.GetCurrentSnapshot());
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 312d126..2fd4c7a 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -109,27 +109,6 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
return 0;
}
-void CMakeMessageCallback(const char* m, const char* /*unused*/,
- bool& /*unused*/, void* s)
-{
- std::string* out = static_cast<std::string*>(s);
- *out += m;
- *out += "\n";
-}
-
-void CMakeProgressCallback(const char* msg, float /*unused*/, void* s)
-{
- std::string* out = static_cast<std::string*>(s);
- *out += msg;
- *out += "\n";
-}
-
-void CMakeOutputCallback(const char* m, size_t len, void* s)
-{
- std::string* out = static_cast<std::string*>(s);
- out->append(m, len);
-}
-
class cmCTestBuildAndTestCaptureRAII
{
cmake& CM;
@@ -138,17 +117,27 @@ public:
cmCTestBuildAndTestCaptureRAII(cmake& cm, std::string& s)
: CM(cm)
{
- cmSystemTools::SetMessageCallback(CMakeMessageCallback, &s);
- cmSystemTools::SetStdoutCallback(CMakeOutputCallback, &s);
- cmSystemTools::SetStderrCallback(CMakeOutputCallback, &s);
- this->CM.SetProgressCallback(CMakeProgressCallback, &s);
+ cmSystemTools::SetMessageCallback(
+ [&s](const char* msg, const char* /*unused*/) {
+ s += msg;
+ s += "\n";
+ });
+
+ 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";
+ });
}
+
~cmCTestBuildAndTestCaptureRAII()
{
- this->CM.SetProgressCallback(nullptr, nullptr);
- cmSystemTools::SetStderrCallback(nullptr, nullptr);
- cmSystemTools::SetStdoutCallback(nullptr, nullptr);
- cmSystemTools::SetMessageCallback(nullptr, nullptr);
+ this->CM.SetProgressCallback(nullptr);
+ cmSystemTools::SetStderrCallback(nullptr);
+ cmSystemTools::SetStdoutCallback(nullptr);
+ cmSystemTools::SetMessageCallback(nullptr);
}
};
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 84f3652..33b8b4a 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -263,15 +263,6 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
return retVal;
}
-static void ctestScriptProgressCallback(const char* m, float /*unused*/,
- void* cd)
-{
- cmCTest* ctest = static_cast<cmCTest*>(cd);
- if (m && *m) {
- cmCTestLog(ctest, HANDLER_OUTPUT, "-- " << m << std::endl);
- }
-}
-
void cmCTestScriptHandler::CreateCMake()
{
// create a cmake instance to read the configuration script
@@ -297,7 +288,11 @@ void cmCTestScriptHandler::CreateCMake()
this->ParentMakefile->GetRecursionDepth());
}
- this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
+ this->CMake->SetProgressCallback([this](const char* m, float /*unused*/) {
+ if (m && *m) {
+ 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/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index dbf4a28..f2982a6 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -65,13 +65,6 @@ void onsig(int /*unused*/)
}
}
-void CMakeMessageHandler(const char* message, const char* title,
- bool& /*unused*/, void* clientData)
-{
- cmCursesForm* self = static_cast<cmCursesForm*>(clientData);
- self->AddError(message, title);
-}
-
int main(int argc, char const* const* argv)
{
cmsys::Encoding::CommandLineArguments encoding_args =
@@ -156,7 +149,10 @@ int main(int argc, char const* const* argv)
return 1;
}
- cmSystemTools::SetMessageCallback(CMakeMessageHandler, myform);
+ cmSystemTools::SetMessageCallback(
+ [myform](const char* message, const char* title) {
+ myform->AddError(message, title);
+ });
cmCursesForm::CurrentForm = myform;
diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h
index cdb9478..8c96256 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.h
+++ b/Source/CursesDialog/cmCursesBoolWidget.h
@@ -12,11 +12,12 @@ class cmCursesMainForm;
class cmCursesBoolWidget : public cmCursesWidget
{
- CM_DISABLE_COPY(cmCursesBoolWidget)
-
public:
cmCursesBoolWidget(int width, int height, int left, int top);
+ cmCursesBoolWidget(cmCursesBoolWidget const&) = delete;
+ cmCursesBoolWidget& operator=(cmCursesBoolWidget const&) = delete;
+
// Description:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h
index 54b2f1f..0a69d3a 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.h
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h
@@ -13,14 +13,17 @@ class cmake;
class cmCursesCacheEntryComposite
{
- CM_DISABLE_COPY(cmCursesCacheEntryComposite)
-
public:
cmCursesCacheEntryComposite(const std::string& key, int labelwidth,
int entrywidth);
cmCursesCacheEntryComposite(const std::string& key, cmake* cm, bool isNew,
int labelwidth, int entrywidth);
~cmCursesCacheEntryComposite();
+
+ cmCursesCacheEntryComposite(cmCursesCacheEntryComposite const&) = delete;
+ cmCursesCacheEntryComposite& operator=(cmCursesCacheEntryComposite const&) =
+ delete;
+
const char* GetValue();
friend class cmCursesMainForm;
diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h
index c509ae7..07b7288 100644
--- a/Source/CursesDialog/cmCursesDummyWidget.h
+++ b/Source/CursesDialog/cmCursesDummyWidget.h
@@ -12,11 +12,12 @@ class cmCursesMainForm;
class cmCursesDummyWidget : public cmCursesWidget
{
- CM_DISABLE_COPY(cmCursesDummyWidget)
-
public:
cmCursesDummyWidget(int width, int height, int left, int top);
+ cmCursesDummyWidget(cmCursesDummyWidget const&) = delete;
+ cmCursesDummyWidget& operator=(cmCursesDummyWidget const&) = delete;
+
// Description:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
diff --git a/Source/CursesDialog/cmCursesFilePathWidget.h b/Source/CursesDialog/cmCursesFilePathWidget.h
index 0a30402..3f71259 100644
--- a/Source/CursesDialog/cmCursesFilePathWidget.h
+++ b/Source/CursesDialog/cmCursesFilePathWidget.h
@@ -9,10 +9,11 @@
class cmCursesFilePathWidget : public cmCursesPathWidget
{
- CM_DISABLE_COPY(cmCursesFilePathWidget)
-
public:
cmCursesFilePathWidget(int width, int height, int left, int top);
+
+ cmCursesFilePathWidget(cmCursesFilePathWidget const&) = delete;
+ cmCursesFilePathWidget& operator=(cmCursesFilePathWidget const&) = delete;
};
#endif // cmCursesFilePathWidget_h
diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h
index 249b349..ddb67de 100644
--- a/Source/CursesDialog/cmCursesForm.h
+++ b/Source/CursesDialog/cmCursesForm.h
@@ -11,12 +11,13 @@
class cmCursesForm
{
- CM_DISABLE_COPY(cmCursesForm)
-
public:
cmCursesForm();
virtual ~cmCursesForm();
+ cmCursesForm(cmCursesForm const&) = delete;
+ cmCursesForm& operator=(cmCursesForm const&) = delete;
+
// Description:
// Handle user input.
virtual void HandleInput() = 0;
diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h
index aab559b..2ee9cfc 100644
--- a/Source/CursesDialog/cmCursesLabelWidget.h
+++ b/Source/CursesDialog/cmCursesLabelWidget.h
@@ -14,13 +14,14 @@ class cmCursesMainForm;
class cmCursesLabelWidget : public cmCursesWidget
{
- CM_DISABLE_COPY(cmCursesLabelWidget)
-
public:
cmCursesLabelWidget(int width, int height, int left, int top,
const std::string& name);
~cmCursesLabelWidget() override;
+ cmCursesLabelWidget(cmCursesLabelWidget const&) = delete;
+ cmCursesLabelWidget& operator=(cmCursesLabelWidget const&) = delete;
+
// Description:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h
index 2bcc15a..466b4e1 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.h
+++ b/Source/CursesDialog/cmCursesLongMessageForm.h
@@ -13,13 +13,14 @@
class cmCursesLongMessageForm : public cmCursesForm
{
- CM_DISABLE_COPY(cmCursesLongMessageForm)
-
public:
cmCursesLongMessageForm(std::vector<std::string> const& messages,
const char* title);
~cmCursesLongMessageForm() override;
+ cmCursesLongMessageForm(cmCursesLongMessageForm const&) = delete;
+ cmCursesLongMessageForm& operator=(cmCursesLongMessageForm const&) = delete;
+
// Description:
// Handle user input.
void HandleInput() override;
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 188ad69..8ca7802 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -506,12 +506,8 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
pos_form_cursor(this->Form);
}
-void cmCursesMainForm::UpdateProgress(const char* msg, float prog, void* vp)
+void cmCursesMainForm::UpdateProgress(const char* msg, float prog)
{
- cmCursesMainForm* cm = static_cast<cmCursesMainForm*>(vp);
- if (!cm) {
- return;
- }
char tmp[1024];
const char* cmsg = tmp;
if (prog >= 0) {
@@ -519,8 +515,8 @@ void cmCursesMainForm::UpdateProgress(const char* msg, float prog, void* vp)
} else {
cmsg = msg;
}
- cm->UpdateStatusBar(cmsg);
- cm->PrintKeys(1);
+ this->UpdateStatusBar(cmsg);
+ this->PrintKeys(1);
curses_move(1, 1);
touchwin(stdscr);
refresh();
@@ -536,8 +532,8 @@ int cmCursesMainForm::Configure(int noconfigure)
this->PrintKeys(1);
touchwin(stdscr);
refresh();
- this->CMakeInstance->SetProgressCallback(cmCursesMainForm::UpdateProgress,
- this);
+ this->CMakeInstance->SetProgressCallback(
+ [this](const char* msg, float prog) { this->UpdateProgress(msg, prog); });
// always save the current gui values to disk
this->FillCacheManagerFromUI();
@@ -560,7 +556,7 @@ int cmCursesMainForm::Configure(int noconfigure)
} else {
retVal = this->CMakeInstance->Configure();
}
- this->CMakeInstance->SetProgressCallback(nullptr, nullptr);
+ this->CMakeInstance->SetProgressCallback(nullptr);
keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
@@ -606,8 +602,8 @@ int cmCursesMainForm::Generate()
this->PrintKeys(1);
touchwin(stdscr);
refresh();
- this->CMakeInstance->SetProgressCallback(cmCursesMainForm::UpdateProgress,
- this);
+ this->CMakeInstance->SetProgressCallback(
+ [this](const char* msg, float prog) { this->UpdateProgress(msg, prog); });
// Get rid of previous errors
this->Errors = std::vector<std::string>();
@@ -615,7 +611,7 @@ int cmCursesMainForm::Generate()
// run the generate process
int retVal = this->CMakeInstance->Generate();
- this->CMakeInstance->SetProgressCallback(nullptr, nullptr);
+ this->CMakeInstance->SetProgressCallback(nullptr);
keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
if (retVal != 0 || !this->Errors.empty()) {
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 824025b..cc6482f 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -23,12 +23,13 @@ class cmake;
*/
class cmCursesMainForm : public cmCursesForm
{
- CM_DISABLE_COPY(cmCursesMainForm)
-
public:
cmCursesMainForm(std::vector<std::string> args, int initwidth);
~cmCursesMainForm() override;
+ cmCursesMainForm(cmCursesMainForm const&) = delete;
+ cmCursesMainForm& operator=(cmCursesMainForm const&) = delete;
+
/**
* Set the widgets which represent the cache entries.
*/
@@ -101,8 +102,7 @@ public:
/**
* Progress callback
*/
- static void UpdateProgressOld(const char* msg, float prog, void*);
- static void UpdateProgress(const char* msg, float prog, void*);
+ void UpdateProgress(const char* msg, float prog);
protected:
// Copy the cache values from the user interface to the actual
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h
index 3e50e2d..0128d6a 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.h
+++ b/Source/CursesDialog/cmCursesOptionsWidget.h
@@ -15,11 +15,12 @@ class cmCursesMainForm;
class cmCursesOptionsWidget : public cmCursesWidget
{
- CM_DISABLE_COPY(cmCursesOptionsWidget)
-
public:
cmCursesOptionsWidget(int width, int height, int left, int top);
+ cmCursesOptionsWidget(cmCursesOptionsWidget const&) = delete;
+ cmCursesOptionsWidget& operator=(cmCursesOptionsWidget const&) = delete;
+
// Description:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h
index bfa0ea3..1eace03 100644
--- a/Source/CursesDialog/cmCursesPathWidget.h
+++ b/Source/CursesDialog/cmCursesPathWidget.h
@@ -14,11 +14,12 @@ class cmCursesMainForm;
class cmCursesPathWidget : public cmCursesStringWidget
{
- CM_DISABLE_COPY(cmCursesPathWidget)
-
public:
cmCursesPathWidget(int width, int height, int left, int top);
+ cmCursesPathWidget(cmCursesPathWidget const&) = delete;
+ cmCursesPathWidget& operator=(cmCursesPathWidget const&) = delete;
+
/**
* This method is called when different keys are pressed. The
* subclass can have a special implementation handler for this.
diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h
index 90310f6..021515b 100644
--- a/Source/CursesDialog/cmCursesStringWidget.h
+++ b/Source/CursesDialog/cmCursesStringWidget.h
@@ -20,11 +20,12 @@ class cmCursesMainForm;
class cmCursesStringWidget : public cmCursesWidget
{
- CM_DISABLE_COPY(cmCursesStringWidget)
-
public:
cmCursesStringWidget(int width, int height, int left, int top);
+ cmCursesStringWidget(cmCursesStringWidget const&) = delete;
+ cmCursesStringWidget& operator=(cmCursesStringWidget const&) = delete;
+
/**
* Handle user input. Called by the container of this widget
* when this widget has focus. Returns true if the input was
diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h
index a44c5e6..f761f6d 100644
--- a/Source/CursesDialog/cmCursesWidget.h
+++ b/Source/CursesDialog/cmCursesWidget.h
@@ -14,12 +14,13 @@ class cmCursesMainForm;
class cmCursesWidget
{
- CM_DISABLE_COPY(cmCursesWidget)
-
public:
cmCursesWidget(int width, int height, int left, int top);
virtual ~cmCursesWidget();
+ cmCursesWidget(cmCursesWidget const&) = delete;
+ cmCursesWidget& operator=(cmCursesWidget const&) = delete;
+
/**
* Handle user input. Called by the container of this widget
* when this widget has focus. Returns true if the input was
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 2eecce6..a073c30 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -23,16 +23,26 @@ QCMake::QCMake(QObject* p)
cmSystemTools::DisableRunCommandOutput();
cmSystemTools::SetRunCommandHideConsole(true);
- cmSystemTools::SetMessageCallback(QCMake::messageCallback, this);
- cmSystemTools::SetStdoutCallback(QCMake::stdoutCallback, this);
- cmSystemTools::SetStderrCallback(QCMake::stderrCallback, this);
+
+ cmSystemTools::SetMessageCallback(
+ [this](const char* msg, const char* title) {
+ this->messageCallback(msg, title);
+ });
+ cmSystemTools::SetStdoutCallback(
+ [this](std::string const& msg) { this->stdoutCallback(msg); });
+ cmSystemTools::SetStderrCallback(
+ [this](std::string const& msg) { this->stderrCallback(msg); });
this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project);
this->CMakeInstance->SetCMakeEditCommand(
cmSystemTools::GetCMakeGUICommand());
- this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this);
+ this->CMakeInstance->SetProgressCallback(
+ [this](const char* msg, float percent) {
+ this->progressCallback(msg, percent);
+ });
- cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this);
+ cmSystemTools::SetInterruptCallback(
+ [this] { return this->interruptCallback(); });
std::vector<cmake::GeneratorInfo> generators;
this->CMakeInstance->GetRegisteredGenerators(
@@ -330,46 +340,40 @@ void QCMake::interrupt()
this->InterruptFlag.ref();
}
-bool QCMake::interruptCallback(void* cd)
+bool QCMake::interruptCallback()
{
- QCMake* self = reinterpret_cast<QCMake*>(cd);
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- return self->InterruptFlag;
+ return this->InterruptFlag;
#else
- return self->InterruptFlag.load();
+ return this->InterruptFlag.load();
#endif
}
-void QCMake::progressCallback(const char* msg, float percent, void* cd)
+void QCMake::progressCallback(const char* msg, float percent)
{
- QCMake* self = reinterpret_cast<QCMake*>(cd);
if (percent >= 0) {
- emit self->progressChanged(QString::fromLocal8Bit(msg), percent);
+ emit this->progressChanged(QString::fromLocal8Bit(msg), percent);
} else {
- emit self->outputMessage(QString::fromLocal8Bit(msg));
+ emit this->outputMessage(QString::fromLocal8Bit(msg));
}
QCoreApplication::processEvents();
}
-void QCMake::messageCallback(const char* msg, const char* /*title*/,
- bool& /*stop*/, void* cd)
+void QCMake::messageCallback(const char* msg, const char* /*title*/)
{
- QCMake* self = reinterpret_cast<QCMake*>(cd);
- emit self->errorMessage(QString::fromLocal8Bit(msg));
+ emit this->errorMessage(QString::fromLocal8Bit(msg));
QCoreApplication::processEvents();
}
-void QCMake::stdoutCallback(const char* msg, size_t len, void* cd)
+void QCMake::stdoutCallback(std::string const& msg)
{
- QCMake* self = reinterpret_cast<QCMake*>(cd);
- emit self->outputMessage(QString::fromLocal8Bit(msg, int(len)));
+ emit this->outputMessage(QString::fromStdString(msg));
QCoreApplication::processEvents();
}
-void QCMake::stderrCallback(const char* msg, size_t len, void* cd)
+void QCMake::stderrCallback(std::string const& msg)
{
- QCMake* self = reinterpret_cast<QCMake*>(cd);
- emit self->outputMessage(QString::fromLocal8Bit(msg, int(len)));
+ emit this->outputMessage(QString::fromStdString(msg));
QCoreApplication::processEvents();
}
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index c84da58..ef4d2a1 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -167,12 +167,12 @@ signals:
protected:
cmake* CMakeInstance;
- static bool interruptCallback(void*);
- static void progressCallback(const char* msg, float percent, void* cd);
- static void messageCallback(const char* msg, const char* title, bool&,
- void* cd);
- static void stdoutCallback(const char* msg, size_t len, void* cd);
- static void stderrCallback(const char* msg, size_t len, void* cd);
+ bool interruptCallback();
+ void progressCallback(const char* msg, float percent);
+ void messageCallback(const char* msg, const char* title);
+ void stdoutCallback(std::string const& msg);
+ void stderrCallback(std::string const& msg);
+
bool WarnUninitializedMode;
bool WarnUnusedMode;
bool WarnUnusedAllMode;
diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h
index ec81cb9..93032c1 100644
--- a/Source/cmCLocaleEnvironmentScope.h
+++ b/Source/cmCLocaleEnvironmentScope.h
@@ -10,12 +10,14 @@
class cmCLocaleEnvironmentScope
{
- CM_DISABLE_COPY(cmCLocaleEnvironmentScope)
-
public:
cmCLocaleEnvironmentScope();
~cmCLocaleEnvironmentScope();
+ cmCLocaleEnvironmentScope(cmCLocaleEnvironmentScope const&) = delete;
+ cmCLocaleEnvironmentScope& operator=(cmCLocaleEnvironmentScope const&) =
+ delete;
+
private:
std::string GetEnv(std::string const& key);
void SetEnv(std::string const& key, std::string const& value);
diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h
index e580e04..ad943c5 100644
--- a/Source/cmCPackPropertiesGenerator.h
+++ b/Source/cmCPackPropertiesGenerator.h
@@ -20,13 +20,15 @@ class cmLocalGenerator;
*/
class cmCPackPropertiesGenerator : public cmScriptGenerator
{
- CM_DISABLE_COPY(cmCPackPropertiesGenerator)
-
public:
cmCPackPropertiesGenerator(cmLocalGenerator* lg,
cmInstalledFile const& installedFile,
std::vector<std::string> const& configurations);
+ cmCPackPropertiesGenerator(cmCPackPropertiesGenerator const&) = delete;
+ cmCPackPropertiesGenerator& operator=(cmCPackPropertiesGenerator const&) =
+ delete;
+
protected:
void GenerateScriptForConfig(std::ostream& os, const std::string& config,
Indent indent) override;
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 07333bb..9ccd773 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -24,8 +24,6 @@ struct cmListFileArgument;
*/
class cmCommand
{
- CM_DISABLE_COPY(cmCommand)
-
public:
/**
* Construct the command. By default it has no makefile.
@@ -37,6 +35,9 @@ public:
*/
virtual ~cmCommand() = default;
+ cmCommand(cmCommand const&) = delete;
+ cmCommand& operator=(cmCommand const&) = delete;
+
/**
* Specify the makefile.
*/
diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h
index 4dc238e..25e6892 100644
--- a/Source/cmCommandArgumentParserHelper.h
+++ b/Source/cmCommandArgumentParserHelper.h
@@ -12,8 +12,6 @@ class cmMakefile;
class cmCommandArgumentParserHelper
{
- CM_DISABLE_COPY(cmCommandArgumentParserHelper)
-
public:
struct ParserType
{
@@ -23,6 +21,10 @@ public:
cmCommandArgumentParserHelper();
~cmCommandArgumentParserHelper();
+ cmCommandArgumentParserHelper(cmCommandArgumentParserHelper const&) = delete;
+ cmCommandArgumentParserHelper& operator=(
+ cmCommandArgumentParserHelper const&) = delete;
+
int ParseString(const char* str, int verb);
// For the lexer:
diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h
index 9579861..dc934be 100644
--- a/Source/cmCommandArgumentsHelper.h
+++ b/Source/cmCommandArgumentsHelper.h
@@ -103,7 +103,6 @@ private:
std::vector<std::string> Vector;
unsigned int DataStart;
const char* Ignore;
- cmCAStringVector();
bool DoConsume(const std::string& arg, unsigned int index) override;
void DoReset() override;
};
@@ -125,7 +124,6 @@ private:
unsigned int DataStart;
bool DoConsume(const std::string& arg, unsigned int index) override;
void DoReset() override;
- cmCAString();
};
/** cmCAEnabler is to be used for options which are off by default and can be
@@ -143,7 +141,6 @@ private:
bool Enabled;
bool DoConsume(const std::string& arg, unsigned int index) override;
void DoReset() override;
- cmCAEnabler();
};
/** cmCADisable is to be used for options which are on by default and can be
@@ -161,7 +158,6 @@ private:
bool Enabled;
bool DoConsume(const std::string& arg, unsigned int index) override;
void DoReset() override;
- cmCADisabler();
};
/** Group of arguments, needed for ordering. E.g. WIN32, EXCLUDE_FROM_ALL and
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index 9d00c21..19b1cd4 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -26,8 +26,4 @@
#define CM_FALLTHROUGH cmsys_FALLTHROUGH
-#define CM_DISABLE_COPY(Class) \
- Class(Class const&) = delete; \
- Class& operator=(Class const&) = delete;
-
#endif
diff --git a/Source/cmConnection.h b/Source/cmConnection.h
index 3a7f1b9..092b913 100644
--- a/Source/cmConnection.h
+++ b/Source/cmConnection.h
@@ -60,11 +60,12 @@ public:
class cmConnection
{
- CM_DISABLE_COPY(cmConnection)
-
public:
cmConnection() = default;
+ cmConnection(cmConnection const&) = delete;
+ cmConnection& operator=(cmConnection const&) = delete;
+
virtual void WriteData(const std::string& data) = 0;
virtual ~cmConnection();
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index 1f2a1b5..b712f09 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -15,8 +15,6 @@
*/
class cmCryptoHash
{
- CM_DISABLE_COPY(cmCryptoHash)
-
public:
enum Algo
{
@@ -35,6 +33,9 @@ public:
cmCryptoHash(Algo algo);
~cmCryptoHash();
+ cmCryptoHash(cmCryptoHash const&) = delete;
+ cmCryptoHash& operator=(cmCryptoHash const&) = delete;
+
/// @brief Returns a new hash generator of the requested type
/// @arg algo Hash type name. Supported hash types are
/// MD5, SHA1, SHA224, SHA256, SHA384, SHA512,
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index c5e1d5b..20c91ca 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -24,13 +24,14 @@ class cmLocalGenerator;
*/
class cmDepends
{
- CM_DISABLE_COPY(cmDepends)
-
public:
/** Instances need to know the build directory name and the relative
path from the build directory to the target file. */
cmDepends(cmLocalGenerator* lg = nullptr, std::string targetDir = "");
+ cmDepends(cmDepends const&) = delete;
+ cmDepends& operator=(cmDepends const&) = delete;
+
/** Set the local generator for the directory in which we are
scanning dependencies. This is not a full local generator; it
has been setup to do relative path conversions for the current
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index 411458a..eee5ae1 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -22,8 +22,6 @@ class cmLocalGenerator;
*/
class cmDependsC : public cmDepends
{
- CM_DISABLE_COPY(cmDependsC)
-
public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
@@ -35,6 +33,9 @@ public:
/** Virtual destructor to cleanup subclasses properly. */
~cmDependsC() override;
+ cmDependsC(cmDependsC const&) = delete;
+ cmDependsC& operator=(cmDependsC const&) = delete;
+
protected:
// Implement writing/checking methods required by superclass.
bool WriteDependencies(const std::set<std::string>& sources,
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index f5f5be2..bf09904 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -21,8 +21,6 @@ class cmLocalGenerator;
*/
class cmDependsFortran : public cmDepends
{
- CM_DISABLE_COPY(cmDependsFortran)
-
public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
@@ -37,6 +35,9 @@ public:
/** Virtual destructor to cleanup subclasses properly. */
~cmDependsFortran() override;
+ cmDependsFortran(cmDependsFortran const&) = delete;
+ cmDependsFortran& operator=(cmDependsFortran const&) = delete;
+
/** Callback from build system after a .mod file has been generated
by a Fortran90 compiler to copy the .mod file to the
corresponding stamp file. */
diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h
index 1928c51..109ef13 100644
--- a/Source/cmDependsJava.h
+++ b/Source/cmDependsJava.h
@@ -17,8 +17,6 @@
*/
class cmDependsJava : public cmDepends
{
- CM_DISABLE_COPY(cmDependsJava)
-
public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
@@ -27,6 +25,9 @@ public:
/** Virtual destructor to cleanup subclasses properly. */
~cmDependsJava() override;
+ cmDependsJava(cmDependsJava const&) = delete;
+ cmDependsJava& operator=(cmDependsJava const&) = delete;
+
protected:
// Implement writing/checking methods required by superclass.
bool WriteDependencies(const std::set<std::string>& sources,
diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h
index e9fe97a..4b89388 100644
--- a/Source/cmDynamicLoader.h
+++ b/Source/cmDynamicLoader.h
@@ -14,8 +14,6 @@
class cmDynamicLoader
{
- CM_DISABLE_COPY(cmDynamicLoader)
-
public:
// Description:
// Load a dynamic library into the current process.
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index c2318cd..0f911c1 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -3758,8 +3758,7 @@ bool cmFileCommand::HandleCreateLinkCommand(
// Check if copy-on-error is enabled in the arguments.
if (!completed && copyOnErrorArg.IsEnabled()) {
- completed =
- cmSystemTools::cmCopyFile(fileName.c_str(), newFileName.c_str());
+ completed = cmSystemTools::cmCopyFile(fileName, newFileName);
if (!completed) {
result = "Copy failed: " + cmSystemTools::GetLastSystemError();
}
diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h
index 491a40b..2130d65 100644
--- a/Source/cmFileLock.h
+++ b/Source/cmFileLock.h
@@ -21,12 +21,13 @@ class cmFileLockResult;
*/
class cmFileLock
{
- CM_DISABLE_COPY(cmFileLock)
-
public:
cmFileLock();
~cmFileLock();
+ cmFileLock(cmFileLock const&) = delete;
+ cmFileLock& operator=(cmFileLock const&) = delete;
+
/**
* @brief Lock the file.
* @param timeoutSec Lock timeout. If -1 try until success or fatal error.
diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h
index 0197354..41203ba 100644
--- a/Source/cmFileLockPool.h
+++ b/Source/cmFileLockPool.h
@@ -13,12 +13,13 @@ class cmFileLockResult;
class cmFileLockPool
{
- CM_DISABLE_COPY(cmFileLockPool)
-
public:
cmFileLockPool();
~cmFileLockPool();
+ cmFileLockPool(cmFileLockPool const&) = delete;
+ cmFileLockPool& operator=(cmFileLockPool const&) = delete;
+
//@{
/**
* @brief Function scope control.
@@ -58,12 +59,13 @@ private:
class ScopePool
{
- CM_DISABLE_COPY(ScopePool)
-
public:
ScopePool();
~ScopePool();
+ ScopePool(ScopePool const&) = delete;
+ ScopePool& operator=(ScopePool const&) = delete;
+
cmFileLockResult Lock(const std::string& filename,
unsigned long timeoutSec);
cmFileLockResult Release(const std::string& filename);
diff --git a/Source/cmFileMonitor.h b/Source/cmFileMonitor.h
index 632e751..7ffc929 100644
--- a/Source/cmFileMonitor.h
+++ b/Source/cmFileMonitor.h
@@ -14,12 +14,14 @@ class cmRootWatcher;
class cmFileMonitor
{
- CM_DISABLE_COPY(cmFileMonitor)
public:
cmFileMonitor(uv_loop_t* l);
~cmFileMonitor();
+ cmFileMonitor(cmFileMonitor const&) = delete;
+ cmFileMonitor& operator=(cmFileMonitor const&) = delete;
+
using Callback = std::function<void(const std::string&, int, int)>;
void MonitorPaths(const std::vector<std::string>& paths, Callback const& cb);
void StopMonitoring();
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index f9ac310..c2e0712 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -693,7 +693,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
std::string var = this->Name;
var += "_FIND_MODULE";
this->Makefile->AddDefinition(var, "1");
- bool result = this->ReadListFile(mfile.c_str(), DoPolicyScope);
+ bool result = this->ReadListFile(mfile, DoPolicyScope);
this->Makefile->RemoveDefinition(var);
return result;
}
@@ -776,7 +776,7 @@ bool cmFindPackageCommand::HandlePackageMode()
this->StoreVersionFound();
// Parse the configuration file.
- if (this->ReadListFile(this->FileFound.c_str(), DoPolicyScope)) {
+ if (this->ReadListFile(this->FileFound, DoPolicyScope)) {
// The package has been found.
found = true;
@@ -1036,7 +1036,8 @@ bool cmFindPackageCommand::FindAppBundleConfig()
return false;
}
-bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr)
+bool cmFindPackageCommand::ReadListFile(const std::string& f,
+ PolicyScopeRule psr)
{
const bool noPolicyScope = !this->PolicyScope || psr == NoPolicyScope;
if (this->Makefile->ReadDependentFile(f, noPolicyScope)) {
@@ -1590,7 +1591,7 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file,
// Load the version check file. Pass NoPolicyScope because we do
// our own policy push/pop independent of CMP0011.
bool suitable = false;
- if (this->ReadListFile(version_file.c_str(), NoPolicyScope)) {
+ if (this->ReadListFile(version_file, NoPolicyScope)) {
// Check the output variables.
bool okay = this->Makefile->IsOn("PACKAGE_VERSION_EXACT");
bool unsuitable = this->Makefile->IsOn("PACKAGE_VERSION_UNSUITABLE");
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 83d8431..a11d253 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -110,7 +110,7 @@ private:
NoPolicyScope,
DoPolicyScope
};
- bool ReadListFile(const char* f, PolicyScopeRule psr);
+ bool ReadListFile(const std::string& f, PolicyScopeRule psr);
void StoreVersionFound();
void ComputePrefixes();
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index fd11889..5b1eb51 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -97,6 +97,8 @@ public:
*/
~cmGeneratedFileStream() override;
+ cmGeneratedFileStream(cmGeneratedFileStream const&) = delete;
+
/**
* Open an output file by name. This should be used only with a
* non-open stream. It automatically generates a name for the
@@ -134,9 +136,6 @@ public:
* the output file to be changed during the use of cmGeneratedFileStream.
*/
void SetName(const std::string& fname);
-
-private:
- cmGeneratedFileStream(cmGeneratedFileStream const&); // not implemented
};
#endif
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index e5463a7..fd36c4b 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -32,13 +32,14 @@ struct cmGeneratorExpressionEvaluator;
*/
class cmGeneratorExpression
{
- CM_DISABLE_COPY(cmGeneratorExpression)
-
public:
/** Construct. */
cmGeneratorExpression(cmListFileBacktrace backtrace = cmListFileBacktrace());
~cmGeneratorExpression();
+ cmGeneratorExpression(cmGeneratorExpression const&) = delete;
+ cmGeneratorExpression& operator=(cmGeneratorExpression const&) = delete;
+
std::unique_ptr<cmCompiledGeneratorExpression> Parse(
std::string const& input);
std::unique_ptr<cmCompiledGeneratorExpression> Parse(const char* input);
@@ -78,9 +79,13 @@ private:
class cmCompiledGeneratorExpression
{
- CM_DISABLE_COPY(cmCompiledGeneratorExpression)
-
public:
+ ~cmCompiledGeneratorExpression();
+
+ cmCompiledGeneratorExpression(cmCompiledGeneratorExpression const&) = delete;
+ cmCompiledGeneratorExpression& operator=(
+ cmCompiledGeneratorExpression const&) = delete;
+
const std::string& Evaluate(
cmLocalGenerator* lg, const std::string& config, bool quiet = false,
cmGeneratorTarget const* headTarget = nullptr,
@@ -109,8 +114,6 @@ public:
return this->AllTargetsSeen;
}
- ~cmCompiledGeneratorExpression();
-
std::string const& GetInput() const { return this->Input; }
cmListFileBacktrace GetBacktrace() const { return this->Backtrace; }
@@ -165,8 +168,6 @@ private:
class cmGeneratorExpressionInterpreter
{
- CM_DISABLE_COPY(cmGeneratorExpressionInterpreter)
-
public:
cmGeneratorExpressionInterpreter(cmLocalGenerator* localGenerator,
std::string config,
@@ -179,6 +180,11 @@ public:
{
}
+ cmGeneratorExpressionInterpreter(cmGeneratorExpressionInterpreter const&) =
+ delete;
+ cmGeneratorExpressionInterpreter& operator=(
+ cmGeneratorExpressionInterpreter const&) = delete;
+
const std::string& Evaluate(const char* expression,
const std::string& property);
const std::string& Evaluate(const std::string& expression,
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index 0f553f2..4530152 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -19,6 +19,11 @@ struct cmGeneratorExpressionEvaluator
cmGeneratorExpressionEvaluator() = default;
virtual ~cmGeneratorExpressionEvaluator() = default;
+ cmGeneratorExpressionEvaluator(cmGeneratorExpressionEvaluator const&) =
+ delete;
+ cmGeneratorExpressionEvaluator& operator=(
+ cmGeneratorExpressionEvaluator const&) = delete;
+
enum Type
{
Text,
@@ -29,9 +34,6 @@ struct cmGeneratorExpressionEvaluator
virtual std::string Evaluate(cmGeneratorExpressionContext* context,
cmGeneratorExpressionDAGChecker*) const = 0;
-
-private:
- CM_DISABLE_COPY(cmGeneratorExpressionEvaluator)
};
struct TextContent : public cmGeneratorExpressionEvaluator
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index eb66ed5..aac188e 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -95,7 +95,7 @@ static const struct ZeroNode installInterfaceNode;
#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \
static const struct OP##Node : public cmGeneratorExpressionNode \
{ \
- OP##Node() {} \
+ OP##Node() {} /* NOLINT(modernize-use-equals-default) */ \
virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \
\
std::string Evaluate(const std::vector<std::string>& parameters, \
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index d72e051..59d38af 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -27,12 +27,13 @@ class cmTarget;
class cmGeneratorTarget
{
- CM_DISABLE_COPY(cmGeneratorTarget)
-
public:
cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg);
~cmGeneratorTarget();
+ cmGeneratorTarget(cmGeneratorTarget const&) = delete;
+ cmGeneratorTarget& operator=(cmGeneratorTarget const&) = delete;
+
cmLocalGenerator* GetLocalGenerator() const;
cmGlobalGenerator* GetGlobalGenerator() const;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2b5c98f..386a3f7 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -567,11 +567,6 @@ void cmGlobalGenerator::EnableLanguage(
return;
}
- // Find the native build tool for this generator.
- if (!this->FindMakeProgram(mf)) {
- return;
- }
-
// Tell the generator about the target system.
std::string system = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
if (!this->SetSystemName(system, mf)) {
@@ -592,6 +587,11 @@ void cmGlobalGenerator::EnableLanguage(
cmSystemTools::SetFatalErrorOccured();
return;
}
+
+ // Find the native build tool for this generator.
+ if (!this->FindMakeProgram(mf)) {
+ return;
+ }
}
// Check that the languages are supported by the generator and its
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index e3dd2f9..77be592 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -262,9 +262,8 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros()
// purposes but newer versions distributed with CMake will replace
// older versions in user directories.
int res;
- if (!cmSystemTools::FileTimeCompare(src.c_str(), dst.c_str(), &res) ||
- res > 0) {
- if (!cmSystemTools::CopyFileAlways(src.c_str(), dst.c_str())) {
+ if (!cmSystemTools::FileTimeCompare(src, dst, &res) || res > 0) {
+ if (!cmSystemTools::CopyFileAlways(src, dst)) {
std::ostringstream oss;
oss << "Could not copy from: " << src << std::endl;
oss << " to: " << dst << std::endl;
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index bc6b453..12d9304 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -471,6 +471,18 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand()
// Ask Visual Studio Installer tool.
std::string vs;
if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) {
+ std::string const& hostArch =
+ this->GetPlatformToolsetHostArchitectureString();
+ if (hostArch == "x64") {
+ msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe";
+ if (cmSystemTools::FileExists(msbuild)) {
+ return msbuild;
+ }
+ msbuild = vs + "/MSBuild/15.0/Bin/amd64/MSBuild.exe";
+ if (cmSystemTools::FileExists(msbuild)) {
+ return msbuild;
+ }
+ }
msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe";
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6d15b8c..9c0c18b 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -752,8 +752,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFileFromPath(
class XCodeGeneratorExpressionInterpreter
: public cmGeneratorExpressionInterpreter
{
- CM_DISABLE_COPY(XCodeGeneratorExpressionInterpreter)
-
public:
XCodeGeneratorExpressionInterpreter(cmSourceFile* sourceFile,
cmLocalGenerator* localGenerator,
@@ -765,6 +763,11 @@ public:
{
}
+ XCodeGeneratorExpressionInterpreter(
+ XCodeGeneratorExpressionInterpreter const&) = delete;
+ XCodeGeneratorExpressionInterpreter& operator=(
+ XCodeGeneratorExpressionInterpreter const&) = delete;
+
using cmGeneratorExpressionInterpreter::Evaluate;
const std::string& Evaluate(const char* expression,
diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h
index 8e974af..9c0d417 100644
--- a/Source/cmInstallCommandArguments.h
+++ b/Source/cmInstallCommandArguments.h
@@ -45,7 +45,6 @@ public:
cmCommandArgumentGroup ArgumentGroup;
private:
- cmInstallCommandArguments(); // disabled
cmCAString Destination;
cmCAString Component;
cmCAString NamelinkComponent;
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index e5b88c3..9bd7ac3 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -21,8 +21,6 @@ class cmMakefile;
*/
class cmInstallGenerator : public cmScriptGenerator
{
- CM_DISABLE_COPY(cmInstallGenerator)
-
public:
enum MessageLevel
{
@@ -38,6 +36,9 @@ public:
bool exclude_from_all);
~cmInstallGenerator() override;
+ cmInstallGenerator(cmInstallGenerator const&) = delete;
+ cmInstallGenerator& operator=(cmInstallGenerator const&) = delete;
+
virtual bool HaveInstall();
virtual void CheckCMP0082(bool& haveSubdirectoryInstall,
bool& haveInstallAfterSubdirectory);
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 10df70b..26cebf0 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmake.h"
cmInstallTargetGenerator::cmInstallTargetGenerator(
std::string targetName, const char* dest, bool implib,
@@ -209,8 +210,34 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
// An import library looks like a static library.
type = cmInstallType_STATIC_LIBRARY;
} else if (this->Target->IsFrameworkOnApple()) {
- // There is a bug in cmInstallCommand if this fails.
- assert(this->NamelinkMode == NamelinkModeNone);
+ // FIXME: In principle we should be able to
+ // assert(this->NamelinkMode == NamelinkModeNone);
+ // but since the current install() command implementation checks
+ // the FRAMEWORK property immediately instead of delaying until
+ // generate time, it is possible for project code to set the
+ // property after calling install(). In such a case, the install()
+ // command will use the LIBRARY code path and create two install
+ // generators, one for the namelink component (NamelinkModeOnly)
+ // and one for the primary artifact component (NamelinkModeSkip).
+ // Historically this was not diagnosed and resulted in silent
+ // installation of a framework to the LIBRARY destination.
+ // Retain that behavior and warn about the case.
+ switch (this->NamelinkMode) {
+ case NamelinkModeNone:
+ // Normal case.
+ break;
+ case NamelinkModeOnly:
+ // Assume the NamelinkModeSkip instance will warn and install.
+ return;
+ case NamelinkModeSkip: {
+ std::string e = "Target '" + this->Target->GetName() +
+ "' was changed to a FRAMEWORK sometime after install(). "
+ "This may result in the wrong install DESTINATION. "
+ "Set the FRAMEWORK property earlier.";
+ this->Target->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage(
+ MessageType::AUTHOR_WARNING, e, this->GetBacktrace());
+ } break;
+ }
// Install the whole framework directory.
type = cmInstallType_DIRECTORY;
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index a016358..2355c32 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -16,13 +16,14 @@ class cmOutputConverter;
class cmLinkLineComputer
{
- CM_DISABLE_COPY(cmLinkLineComputer)
-
public:
cmLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir);
virtual ~cmLinkLineComputer();
+ cmLinkLineComputer(cmLinkLineComputer const&) = delete;
+ cmLinkLineComputer& operator=(cmLinkLineComputer const&) = delete;
+
void SetUseWatcomQuote(bool useWatcomQuote);
void SetForResponse(bool forResponse);
void SetRelink(bool relink);
diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h
index 81b48b3..cf66f64 100644
--- a/Source/cmLinkLineDeviceComputer.h
+++ b/Source/cmLinkLineDeviceComputer.h
@@ -18,13 +18,15 @@ class cmStateDirectory;
class cmLinkLineDeviceComputer : public cmLinkLineComputer
{
- CM_DISABLE_COPY(cmLinkLineDeviceComputer)
-
public:
cmLinkLineDeviceComputer(cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir);
~cmLinkLineDeviceComputer() override;
+ cmLinkLineDeviceComputer(cmLinkLineDeviceComputer const&) = delete;
+ cmLinkLineDeviceComputer& operator=(cmLinkLineDeviceComputer const&) =
+ delete;
+
std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
std::string const& stdLibString) override;
@@ -34,13 +36,15 @@ public:
class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer
{
- CM_DISABLE_COPY(cmNinjaLinkLineDeviceComputer)
-
public:
cmNinjaLinkLineDeviceComputer(cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir,
cmGlobalNinjaGenerator const* gg);
+ cmNinjaLinkLineDeviceComputer(cmNinjaLinkLineDeviceComputer const&) = delete;
+ cmNinjaLinkLineDeviceComputer& operator=(
+ cmNinjaLinkLineDeviceComputer const&) = delete;
+
std::string ConvertToLinkReference(std::string const& input) const override;
private:
diff --git a/Source/cmLocale.h b/Source/cmLocale.h
index 174f0f0..3580ec8 100644
--- a/Source/cmLocale.h
+++ b/Source/cmLocale.h
@@ -10,16 +10,18 @@
class cmLocaleRAII
{
- CM_DISABLE_COPY(cmLocaleRAII)
-
public:
cmLocaleRAII()
: OldLocale(setlocale(LC_CTYPE, nullptr))
{
setlocale(LC_CTYPE, "");
}
+
~cmLocaleRAII() { setlocale(LC_CTYPE, this->OldLocale.c_str()); }
+ cmLocaleRAII(cmLocaleRAII const&) = delete;
+ cmLocaleRAII& operator=(cmLocaleRAII const&) = delete;
+
private:
std::string OldLocale;
};
diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h
index 31223ec..d767914 100644
--- a/Source/cmMSVC60LinkLineComputer.h
+++ b/Source/cmMSVC60LinkLineComputer.h
@@ -15,12 +15,14 @@ class cmStateDirectory;
class cmMSVC60LinkLineComputer : public cmLinkLineComputer
{
- CM_DISABLE_COPY(cmMSVC60LinkLineComputer)
-
public:
cmMSVC60LinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir);
+ cmMSVC60LinkLineComputer(cmMSVC60LinkLineComputer const&) = delete;
+ cmMSVC60LinkLineComputer& operator=(cmMSVC60LinkLineComputer const&) =
+ delete;
+
std::string ConvertToLinkReference(std::string const& input) const override;
};
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3ae8034..ab139c0 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3749,8 +3749,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
}
if (copyonly) {
- if (!cmSystemTools::CopyFileIfDifferent(sinfile.c_str(),
- soutfile.c_str())) {
+ if (!cmSystemTools::CopyFileIfDifferent(sinfile, soutfile)) {
return 0;
}
} else {
@@ -3801,8 +3800,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
// close the files before attempting to copy
fin.close();
fout.close();
- if (!cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(),
- soutfile.c_str())) {
+ if (!cmSystemTools::CopyFileIfDifferent(tempOutputFile, soutfile)) {
res = 0;
} else {
cmSystemTools::SetPermissions(soutfile, perm);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 2bd44e2..70a5689 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -65,8 +65,6 @@ public:
*/
class cmMakefile
{
- CM_DISABLE_COPY(cmMakefile)
-
public:
/* Mark a variable as used */
void MarkVariableAsUsed(const std::string& var);
@@ -84,6 +82,9 @@ public:
*/
~cmMakefile();
+ cmMakefile(cmMakefile const&) = delete;
+ cmMakefile& operator=(cmMakefile const&) = delete;
+
cmDirectoryId GetDirectoryId() const;
bool ReadListFile(const std::string& filename);
@@ -780,15 +781,18 @@ public:
/** Helper class to push and pop scopes automatically. */
class ScopePushPop
{
- CM_DISABLE_COPY(ScopePushPop)
public:
ScopePushPop(cmMakefile* m)
: Makefile(m)
{
this->Makefile->PushScope();
}
+
~ScopePushPop() { this->Makefile->PopScope(); }
+ ScopePushPop(ScopePushPop const&) = delete;
+ ScopePushPop& operator=(ScopePushPop const&) = delete;
+
private:
cmMakefile* Makefile;
};
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
index 0ed53f4..b2b2e84 100644
--- a/Source/cmNinjaLinkLineComputer.h
+++ b/Source/cmNinjaLinkLineComputer.h
@@ -16,13 +16,14 @@ class cmStateDirectory;
class cmNinjaLinkLineComputer : public cmLinkLineComputer
{
- CM_DISABLE_COPY(cmNinjaLinkLineComputer)
-
public:
cmNinjaLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir,
cmGlobalNinjaGenerator const* gg);
+ cmNinjaLinkLineComputer(cmNinjaLinkLineComputer const&) = delete;
+ cmNinjaLinkLineComputer& operator=(cmNinjaLinkLineComputer const&) = delete;
+
std::string ConvertToLinkReference(std::string const& input) const override;
private:
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 1d7f6d1..caeed15 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1370,7 +1370,7 @@ void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
this->Target->AddSource(filename, prepend);
}
-static unsigned int CharPtrToInt(const char* const input)
+static unsigned int CharPtrToUInt(const char* const input)
{
unsigned long tmp = 0;
if (input != nullptr && cmSystemTools::StringToULong(input, &tmp)) {
@@ -1379,36 +1379,43 @@ static unsigned int CharPtrToInt(const char* const input)
return 0;
}
-static unsigned int StringToInt(const std::string& input)
-{
- return input.empty() ? 0 : CharPtrToInt(input.c_str());
-}
-
-static std::vector<cmQtAutoGenInitializer::IntegerVersion> GetKnownQtVersions(
+static std::vector<cmQtAutoGen::IntegerVersion> GetKnownQtVersions(
cmGeneratorTarget const* target)
{
cmMakefile* makefile = target->Target->GetMakefile();
-
- std::vector<cmQtAutoGenInitializer::IntegerVersion> result;
- for (const std::string& prefix :
- std::vector<std::string>({ "Qt6Core", "Qt5Core", "QT" })) {
- auto tmp = cmQtAutoGenInitializer::IntegerVersion(
- StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MAJOR")),
- StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MINOR")));
- if (tmp.Major != 0) {
- result.push_back(tmp);
+ std::vector<cmQtAutoGen::IntegerVersion> result;
+ // Adds a version to the result (nullptr safe)
+ auto addVersion = [&result](const char* major, const char* minor) {
+ cmQtAutoGen::IntegerVersion ver(CharPtrToUInt(major),
+ CharPtrToUInt(minor));
+ if (ver.Major != 0) {
+ result.emplace_back(ver);
}
+ };
+ // Qt version variable prefixes
+ std::array<std::string, 3> const prefixes{ { "Qt6Core", "Qt5Core", "QT" } };
+
+ // Read versions from variables
+ for (const std::string& prefix : prefixes) {
+ addVersion(makefile->GetDefinition(prefix + "_VERSION_MAJOR"),
+ makefile->GetDefinition(prefix + "_VERSION_MINOR"));
+ }
+
+ // Read versions from directory properties
+ for (const std::string& prefix : prefixes) {
+ addVersion(makefile->GetProperty(prefix + "_VERSION_MAJOR"),
+ makefile->GetProperty(prefix + "_VERSION_MINOR"));
}
return result;
}
-std::pair<cmQtAutoGenInitializer::IntegerVersion, unsigned int>
+std::pair<cmQtAutoGen::IntegerVersion, unsigned int>
cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target)
{
std::pair<IntegerVersion, unsigned int> res(
IntegerVersion(),
- CharPtrToInt(target->GetLinkInterfaceDependentStringProperty(
+ CharPtrToUInt(target->GetLinkInterfaceDependentStringProperty(
"QT_MAJOR_VERSION", "")));
auto knownQtVersions = GetKnownQtVersions(target);
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index 2b9cbc6..9956a99 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -24,7 +24,6 @@ class cmMakefile;
/// @brief Base class for QtAutoGen gernerators
class cmQtAutoGenerator : public cmQtAutoGen
{
- CM_DISABLE_COPY(cmQtAutoGenerator)
public:
// -- Types
@@ -245,6 +244,9 @@ public:
cmQtAutoGenerator();
virtual ~cmQtAutoGenerator();
+ cmQtAutoGenerator(cmQtAutoGenerator const&) = delete;
+ cmQtAutoGenerator& operator=(cmQtAutoGenerator const&) = delete;
+
// -- Run
bool Run(std::string const& infoFile, std::string const& config);
diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx
index bc496ac..0ba5224 100644
--- a/Source/cmQtAutoGeneratorMocUic.cxx
+++ b/Source/cmQtAutoGeneratorMocUic.cxx
@@ -1111,8 +1111,7 @@ void cmQtAutoGeneratorMocUic::WorkerT::UVProcessStart(uv_async_t* handle)
{
std::lock_guard<std::mutex> lock(wrk.ProcessMutex_);
if (wrk.Process_ && !wrk.Process_->IsStarted()) {
- wrk.Process_->start(handle->loop,
- std::bind(&WorkerT::UVProcessFinished, &wrk));
+ wrk.Process_->start(handle->loop, [&wrk] { wrk.UVProcessFinished(); });
}
}
}
diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h
index 0df2cff..32a6006 100644
--- a/Source/cmQtAutoGeneratorMocUic.h
+++ b/Source/cmQtAutoGeneratorMocUic.h
@@ -28,11 +28,13 @@ class cmMakefile;
// @brief AUTOMOC and AUTOUIC generator
class cmQtAutoGeneratorMocUic : public cmQtAutoGenerator
{
- CM_DISABLE_COPY(cmQtAutoGeneratorMocUic)
public:
cmQtAutoGeneratorMocUic();
~cmQtAutoGeneratorMocUic() override;
+ cmQtAutoGeneratorMocUic(cmQtAutoGeneratorMocUic const&) = delete;
+ cmQtAutoGeneratorMocUic& operator=(cmQtAutoGeneratorMocUic const&) = delete;
+
public:
// -- Types
class WorkerT;
@@ -63,7 +65,6 @@ public:
///
class BaseSettingsT
{
- CM_DISABLE_COPY(BaseSettingsT)
public:
// -- Volatile methods
BaseSettingsT(FileSystem* fileSystem)
@@ -75,6 +76,9 @@ public:
{
}
+ BaseSettingsT(BaseSettingsT const&) = delete;
+ BaseSettingsT& operator=(BaseSettingsT const&) = delete;
+
// -- Const methods
std::string AbsoluteBuildPath(std::string const& relativePath) const;
bool FindHeader(std::string& header,
@@ -103,13 +107,15 @@ public:
///
class MocSettingsT
{
- CM_DISABLE_COPY(MocSettingsT)
public:
MocSettingsT(FileSystem* fileSys)
: FileSys(fileSys)
{
}
+ MocSettingsT(MocSettingsT const&) = delete;
+ MocSettingsT& operator=(MocSettingsT const&) = delete;
+
// -- Const methods
bool skipped(std::string const& fileName) const;
std::string FindMacro(std::string const& content) const;
@@ -145,9 +151,12 @@ public:
///
class UicSettingsT
{
- CM_DISABLE_COPY(UicSettingsT)
public:
UicSettingsT() = default;
+
+ UicSettingsT(UicSettingsT const&) = delete;
+ UicSettingsT& operator=(UicSettingsT const&) = delete;
+
// -- Const methods
bool skipped(std::string const& fileName) const;
@@ -166,10 +175,13 @@ public:
///
class JobT
{
- CM_DISABLE_COPY(JobT)
public:
JobT() = default;
virtual ~JobT() = default;
+
+ JobT(JobT const&) = delete;
+ JobT& operator=(JobT const&) = delete;
+
// -- Abstract processing interface
virtual void Process(WorkerT& wrk) = 0;
};
@@ -293,11 +305,13 @@ public:
///
class WorkerT
{
- CM_DISABLE_COPY(WorkerT)
public:
WorkerT(cmQtAutoGeneratorMocUic* gen, uv_loop_t* uvLoop);
~WorkerT();
+ WorkerT(WorkerT const&) = delete;
+ WorkerT& operator=(WorkerT const&) = delete;
+
// -- Const accessors
cmQtAutoGeneratorMocUic& Gen() const { return *Gen_; }
Logger& Log() const { return Gen_->Log(); }
diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx
index 43ff172..021a15f 100644
--- a/Source/cmQtAutoGeneratorRcc.cxx
+++ b/Source/cmQtAutoGeneratorRcc.cxx
@@ -10,8 +10,6 @@
#include "cmSystemTools.h"
#include "cmUVHandlePtr.h"
-#include <functional>
-
// -- Class methods
cmQtAutoGeneratorRcc::cmQtAutoGeneratorRcc()
@@ -662,8 +660,7 @@ bool cmQtAutoGeneratorRcc::StartProcess(
Process_ = cm::make_unique<ReadOnlyProcessT>();
Process_->setup(&ProcessResult_, mergedOutput, command, workingDirectory);
// Start process
- if (!Process_->start(UVLoop(),
- std::bind(&cm::uv_async_ptr::send, &UVRequest()))) {
+ if (!Process_->start(UVLoop(), [this] { UVRequest().send(); })) {
Log().ErrorFile(GeneratorT::RCC, QrcFile_, ProcessResult_.ErrorMessage);
Error_ = true;
// Clean up
diff --git a/Source/cmQtAutoGeneratorRcc.h b/Source/cmQtAutoGeneratorRcc.h
index 1148071..1ec1c4a 100644
--- a/Source/cmQtAutoGeneratorRcc.h
+++ b/Source/cmQtAutoGeneratorRcc.h
@@ -17,11 +17,13 @@ class cmMakefile;
// @brief AUTORCC generator
class cmQtAutoGeneratorRcc : public cmQtAutoGenerator
{
- CM_DISABLE_COPY(cmQtAutoGeneratorRcc)
public:
cmQtAutoGeneratorRcc();
~cmQtAutoGeneratorRcc() override;
+ cmQtAutoGeneratorRcc(cmQtAutoGeneratorRcc const&) = delete;
+ cmQtAutoGeneratorRcc& operator=(cmQtAutoGeneratorRcc const&) = delete;
+
private:
// -- Types
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index 5792ba8..e334d5b 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -44,13 +44,14 @@ inline std::ostream& operator<<(std::ostream& os,
*/
class cmScriptGenerator
{
- CM_DISABLE_COPY(cmScriptGenerator)
-
public:
cmScriptGenerator(std::string config_var,
std::vector<std::string> configurations);
virtual ~cmScriptGenerator();
+ cmScriptGenerator(cmScriptGenerator const&) = delete;
+ cmScriptGenerator& operator=(cmScriptGenerator const&) = delete;
+
void Generate(std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes);
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index f7d3879..e740c05 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -96,11 +96,16 @@ void cmServer::ProcessRequest(cmConnection* connection,
return;
}
- cmSystemTools::SetMessageCallback(reportMessage,
- const_cast<cmServerRequest*>(&request));
+ cmSystemTools::SetMessageCallback(
+ [&request](const char* msg, const char* title) {
+ reportMessage(msg, title, request);
+ });
+
if (this->Protocol) {
this->Protocol->CMakeInstance()->SetProgressCallback(
- reportProgress, const_cast<cmServerRequest*>(&request));
+ [&request](const char* msg, float prog) {
+ reportProgress(msg, prog, request);
+ });
this->WriteResponse(connection, this->Protocol->Process(request),
debug.get());
} else {
@@ -150,28 +155,25 @@ void cmServer::PrintHello(cmConnection* connection) const
this->WriteJsonObject(connection, hello, nullptr);
}
-void cmServer::reportProgress(const char* msg, float progress, void* data)
+void cmServer::reportProgress(const char* msg, float progress,
+ const cmServerRequest& request)
{
- const cmServerRequest* request = static_cast<const cmServerRequest*>(data);
- assert(request);
if (progress < 0.0f || progress > 1.0f) {
- request->ReportMessage(msg, "");
+ request.ReportMessage(msg, "");
} else {
- request->ReportProgress(0, static_cast<int>(progress * 1000), 1000, msg);
+ request.ReportProgress(0, static_cast<int>(progress * 1000), 1000, msg);
}
}
void cmServer::reportMessage(const char* msg, const char* title,
- bool& /* cancel */, void* data)
+ const cmServerRequest& request)
{
- const cmServerRequest* request = static_cast<const cmServerRequest*>(data);
- assert(request);
assert(msg);
std::string titleString;
if (title) {
titleString = title;
}
- request->ReportMessage(std::string(msg), titleString);
+ request.ReportMessage(std::string(msg), titleString);
}
cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request)
diff --git a/Source/cmServer.h b/Source/cmServer.h
index ca37ce2..e1ed27a 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -88,14 +88,15 @@ protected:
class cmServer : public cmServerBase
{
- CM_DISABLE_COPY(cmServer)
-
public:
class DebugInfo;
cmServer(cmConnection* conn, bool supportExperimental);
~cmServer() override;
+ cmServer(cmServer const&) = delete;
+ cmServer& operator=(cmServer const&) = delete;
+
bool Serve(std::string* errorMessage) override;
cmFileMonitor* FileMonitor() const;
@@ -118,9 +119,10 @@ public:
void OnConnected(cmConnection* connection) override;
private:
- static void reportProgress(const char* msg, float progress, void* data);
- static void reportMessage(const char* msg, const char* title, bool& cancel,
- void* data);
+ static void reportProgress(const char* msg, float progress,
+ const cmServerRequest& request);
+ static void reportMessage(const char* msg, const char* title,
+ const cmServerRequest& request);
// Handle requests:
cmServerResponse SetProtocolVersion(const cmServerRequest& request);
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index 2d1507b..2f55a20 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -71,12 +71,13 @@ private:
class cmServerProtocol
{
- CM_DISABLE_COPY(cmServerProtocol)
-
public:
cmServerProtocol() = default;
virtual ~cmServerProtocol() = default;
+ cmServerProtocol(cmServerProtocol const&) = delete;
+ cmServerProtocol& operator=(cmServerProtocol const&) = delete;
+
virtual std::pair<int, int> ProtocolVersion() const = 0;
virtual bool IsExperimental() const = 0;
virtual const cmServerResponse Process(const cmServerRequest& request) = 0;
diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h
index 82747ba..cb35703 100644
--- a/Source/cmSourceFileLocation.h
+++ b/Source/cmSourceFileLocation.h
@@ -34,6 +34,8 @@ public:
cmSourceFileLocation();
cmSourceFileLocation(const cmSourceFileLocation& loc);
+ cmSourceFileLocation& operator=(cmSourceFileLocation const&) = delete;
+
/**
* Return whether the given source file location could refers to the
* same source file as this location given the level of ambiguity in
@@ -94,8 +96,6 @@ private:
// Update the location with additional knowledge.
void Update(cmSourceFileLocation const& loc);
void UpdateExtension(const std::string& name);
-
- cmSourceFileLocation& operator=(const cmSourceFileLocation& loc) = delete;
};
#endif
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index f7de3aa..5d8c079 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -76,6 +76,15 @@
# include <malloc.h> /* for malloc/free on QNX */
#endif
+namespace {
+
+cmSystemTools::InterruptCallback s_InterruptCallback;
+cmSystemTools::MessageCallback s_MessageCallback;
+cmSystemTools::OutputCallback s_StderrCallback;
+cmSystemTools::OutputCallback s_StdoutCallback;
+
+} // namespace
+
static bool cm_isspace(char c)
{
return ((c & 0x80) == 0) && isspace(c);
@@ -161,15 +170,6 @@ bool cmSystemTools::s_FatalErrorOccured = false;
bool cmSystemTools::s_DisableMessages = false;
bool cmSystemTools::s_ForceUnixPaths = false;
-cmSystemTools::MessageCallback cmSystemTools::s_MessageCallback;
-cmSystemTools::OutputCallback cmSystemTools::s_StdoutCallback;
-cmSystemTools::OutputCallback cmSystemTools::s_StderrCallback;
-cmSystemTools::InterruptCallback cmSystemTools::s_InterruptCallback;
-void* cmSystemTools::s_MessageCallbackClientData;
-void* cmSystemTools::s_StdoutCallbackClientData;
-void* cmSystemTools::s_StderrCallbackClientData;
-void* cmSystemTools::s_InterruptCallbackClientData;
-
// replace replace with with as many times as it shows up in source.
// write the result into source.
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -277,42 +277,38 @@ void cmSystemTools::Error(const std::string& m)
cmSystemTools::Message(message, "Error");
}
-void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData)
+void cmSystemTools::SetInterruptCallback(InterruptCallback f)
{
- s_InterruptCallback = f;
- s_InterruptCallbackClientData = clientData;
+ s_InterruptCallback = std::move(f);
}
bool cmSystemTools::GetInterruptFlag()
{
if (s_InterruptCallback) {
- return (*s_InterruptCallback)(s_InterruptCallbackClientData);
+ return s_InterruptCallback();
}
return false;
}
-void cmSystemTools::SetMessageCallback(MessageCallback f, void* clientData)
+void cmSystemTools::SetMessageCallback(MessageCallback f)
{
- s_MessageCallback = f;
- s_MessageCallbackClientData = clientData;
+ s_MessageCallback = std::move(f);
}
-void cmSystemTools::SetStdoutCallback(OutputCallback f, void* clientData)
+void cmSystemTools::SetStdoutCallback(OutputCallback f)
{
- s_StdoutCallback = f;
- s_StdoutCallbackClientData = clientData;
+ s_StdoutCallback = std::move(f);
}
-void cmSystemTools::SetStderrCallback(OutputCallback f, void* clientData)
+void cmSystemTools::SetStderrCallback(OutputCallback f)
{
- s_StderrCallback = f;
- s_StderrCallbackClientData = clientData;
+ s_StderrCallback = std::move(f);
}
void cmSystemTools::Stderr(const std::string& s)
{
if (s_StderrCallback) {
- (*s_StderrCallback)(s.c_str(), s.length(), s_StderrCallbackClientData);
+ s_StderrCallback(s);
} else {
std::cerr << s << std::flush;
}
@@ -321,7 +317,7 @@ void cmSystemTools::Stderr(const std::string& s)
void cmSystemTools::Stdout(const std::string& s)
{
if (s_StdoutCallback) {
- (*s_StdoutCallback)(s.c_str(), s.length(), s_StdoutCallbackClientData);
+ s_StdoutCallback(s);
} else {
std::cout << s << std::flush;
}
@@ -333,8 +329,7 @@ void cmSystemTools::Message(const char* m1, const char* title)
return;
}
if (s_MessageCallback) {
- (*s_MessageCallback)(m1, title, s_DisableMessages,
- s_MessageCallbackClientData);
+ s_MessageCallback(m1, title);
return;
}
std::cerr << m1 << std::endl << std::flush;
@@ -940,17 +935,12 @@ std::string cmSystemTools::FileExistsInParentDirectories(const char* fname,
return "";
}
-bool cmSystemTools::cmCopyFile(const char* source, const char* destination)
+bool cmSystemTools::cmCopyFile(const std::string& source,
+ const std::string& destination)
{
return Superclass::CopyFileAlways(source, destination);
}
-bool cmSystemTools::CopyFileIfDifferent(const char* source,
- const char* destination)
-{
- return Superclass::CopyFileIfDifferent(source, destination);
-}
-
#ifdef _WIN32
cmSystemTools::WindowsFileRetry cmSystemTools::GetWindowsFileRetry()
{
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index b1d5751..fcb2cce 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -10,6 +10,7 @@
#include "cmProcessOutput.h"
#include "cmsys/Process.h"
#include "cmsys/SystemTools.hxx" // IWYU pragma: export
+#include <functional>
#include <stddef.h>
#include <string>
#include <vector>
@@ -55,15 +56,13 @@ public:
*/
static std::string TrimWhitespace(const std::string& s);
- typedef void (*MessageCallback)(const char*, const char*, bool&, void*);
+ using MessageCallback = std::function<void(const char*, const char*)>;
/**
* Set the function used by GUIs to display error messages
* Function gets passed: message as a const char*,
- * title as a const char*, and a reference to bool that when
- * set to false, will disable further messages (cancel).
+ * title as a const char*.
*/
- static void SetMessageCallback(MessageCallback f,
- void* clientData = nullptr);
+ static void SetMessageCallback(MessageCallback f);
/**
* Display an error message.
@@ -81,19 +80,18 @@ public:
Message(m.c_str(), title);
}
- typedef void (*OutputCallback)(const char*, size_t length, void*);
+ using OutputCallback = std::function<void(std::string const&)>;
///! Send a string to stdout
static void Stdout(const std::string& s);
- static void SetStdoutCallback(OutputCallback, void* clientData = nullptr);
+ static void SetStdoutCallback(OutputCallback f);
///! Send a string to stderr
static void Stderr(const std::string& s);
- static void SetStderrCallback(OutputCallback, void* clientData = nullptr);
+ static void SetStderrCallback(OutputCallback f);
- typedef bool (*InterruptCallback)(void*);
- static void SetInterruptCallback(InterruptCallback f,
- void* clientData = nullptr);
+ using InterruptCallback = std::function<bool()>;
+ static void SetInterruptCallback(InterruptCallback f);
static bool GetInterruptFlag();
///! Return true if there was an error at any point.
@@ -179,8 +177,8 @@ public:
std::vector<std::string>& files, int type = 0);
///! Copy a file.
- static bool cmCopyFile(const char* source, const char* destination);
- static bool CopyFileIfDifferent(const char* source, const char* destination);
+ static bool cmCopyFile(const std::string& source,
+ const std::string& destination);
/** Rename a file or directory within a single disk volume (atomic
if possible). */
@@ -410,11 +408,13 @@ public:
original environment. */
class SaveRestoreEnvironment
{
- CM_DISABLE_COPY(SaveRestoreEnvironment)
public:
SaveRestoreEnvironment();
~SaveRestoreEnvironment();
+ SaveRestoreEnvironment(SaveRestoreEnvironment const&) = delete;
+ SaveRestoreEnvironment& operator=(SaveRestoreEnvironment const&) = delete;
+
private:
std::vector<std::string> Env;
};
@@ -548,14 +548,6 @@ private:
static bool s_FatalErrorOccured;
static bool s_DisableMessages;
static bool s_DisableRunCommandOutput;
- static MessageCallback s_MessageCallback;
- static OutputCallback s_StdoutCallback;
- static OutputCallback s_StderrCallback;
- static InterruptCallback s_InterruptCallback;
- static void* s_MessageCallbackClientData;
- static void* s_StdoutCallbackClientData;
- static void* s_StderrCallbackClientData;
- static void* s_InterruptCallbackClientData;
};
#endif
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index f26d2ff..8b9cf78 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -20,14 +20,15 @@ class cmTest;
*/
class cmTestGenerator : public cmScriptGenerator
{
- CM_DISABLE_COPY(cmTestGenerator)
-
public:
cmTestGenerator(cmTest* test,
std::vector<std::string> const& configurations =
std::vector<std::string>());
~cmTestGenerator() override;
+ cmTestGenerator(cmTestGenerator const&) = delete;
+ cmTestGenerator& operator=(cmTestGenerator const&) = delete;
+
void Compute(cmLocalGenerator* lg);
/** Test if this generator installs the test for a given configuration. */
diff --git a/Source/cmUVHandlePtr.h b/Source/cmUVHandlePtr.h
index d42969e..992c429 100644
--- a/Source/cmUVHandlePtr.h
+++ b/Source/cmUVHandlePtr.h
@@ -61,7 +61,8 @@ protected:
void allocate(void* data = nullptr);
public:
- CM_DISABLE_COPY(uv_handle_ptr_base_)
+ uv_handle_ptr_base_(uv_handle_ptr_base_ const&) = delete;
+ uv_handle_ptr_base_& operator=(uv_handle_ptr_base_ const&) = delete;
uv_handle_ptr_base_(uv_handle_ptr_base_&&) noexcept;
uv_handle_ptr_base_& operator=(uv_handle_ptr_base_&&) noexcept;
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index 01ef5cb..9648b21 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -100,6 +100,6 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source,
// close the files before attempting to copy
fin.close();
fout.close();
- cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(), outFile.c_str());
+ cmSystemTools::CopyFileIfDifferent(tempOutputFile, outFile);
cmSystemTools::RemoveFile(tempOutputFile);
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 7d24e88..5901004 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -25,12 +25,16 @@ class cmVS10GeneratorOptions;
class cmVisualStudio10TargetGenerator
{
- CM_DISABLE_COPY(cmVisualStudio10TargetGenerator)
-
public:
cmVisualStudio10TargetGenerator(cmGeneratorTarget* target,
cmGlobalVisualStudio10Generator* gg);
~cmVisualStudio10TargetGenerator();
+
+ cmVisualStudio10TargetGenerator(cmVisualStudio10TargetGenerator const&) =
+ delete;
+ cmVisualStudio10TargetGenerator& operator=(
+ cmVisualStudio10TargetGenerator const&) = delete;
+
void Generate();
private:
diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h
index b080654..1df8a09 100644
--- a/Source/cmXMLWriter.h
+++ b/Source/cmXMLWriter.h
@@ -16,12 +16,13 @@
class cmXMLWriter
{
- CM_DISABLE_COPY(cmXMLWriter)
-
public:
cmXMLWriter(std::ostream& output, std::size_t level = 0);
~cmXMLWriter();
+ cmXMLWriter(cmXMLWriter const&) = delete;
+ cmXMLWriter& operator=(cmXMLWriter const&) = delete;
+
void StartDocument(const char* encoding = "UTF-8");
void EndDocument();
diff --git a/Source/cm_thread.hxx b/Source/cm_thread.hxx
index 84e6a5c..b1f0645 100644
--- a/Source/cm_thread.hxx
+++ b/Source/cm_thread.hxx
@@ -11,18 +11,18 @@ namespace cm {
class shared_mutex
{
uv_rwlock_t _M_;
- CM_DISABLE_COPY(shared_mutex)
public:
shared_mutex() { uv_rwlock_init(&_M_); }
~shared_mutex() { uv_rwlock_destroy(&_M_); }
- void lock() { uv_rwlock_wrlock(&_M_); }
+ shared_mutex(shared_mutex const&) = delete;
+ shared_mutex& operator=(shared_mutex const&) = delete;
+ void lock() { uv_rwlock_wrlock(&_M_); }
void unlock() { uv_rwlock_wrunlock(&_M_); }
void lock_shared() { uv_rwlock_rdlock(&_M_); }
-
void unlock_shared() { uv_rwlock_rdunlock(&_M_); }
};
@@ -30,7 +30,6 @@ template <typename T>
class shared_lock
{
T& _mutex;
- CM_DISABLE_COPY(shared_lock)
public:
shared_lock(T& m)
@@ -38,7 +37,12 @@ public:
{
_mutex.lock_shared();
}
+
~shared_lock() { _mutex.unlock_shared(); }
+
+ shared_lock(shared_lock const&) = delete;
+ shared_lock& operator=(shared_lock const&) = delete;
};
}
+
#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 70316f1..8023298 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -157,8 +157,6 @@ cmake::cmake(Role role, cmState::Mode mode)
#endif
this->GlobalGenerator = nullptr;
- this->ProgressCallback = nullptr;
- this->ProgressCallbackClientData = nullptr;
this->CurrentWorkingMode = NORMAL_MODE;
#ifdef CMAKE_BUILD_WITH_CMAKE
@@ -439,7 +437,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
}
std::cout << "loading initial cache file " << path << "\n";
- this->ReadListFile(args, path.c_str());
+ this->ReadListFile(args, path);
} else if (arg.find("-P", 0) == 0) {
i++;
if (i >= args.size()) {
@@ -453,7 +451,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
// Register fake project commands that hint misuse in script mode.
GetProjectCommandsInScriptMode(this->State);
- this->ReadListFile(args, path.c_str());
+ this->ReadListFile(args, path);
} else if (arg.find("--find-package", 0) == 0) {
findPackageMode = true;
}
@@ -467,7 +465,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
void cmake::ReadListFile(const std::vector<std::string>& args,
- const char* path)
+ const std::string& path)
{
// if a generator was not yet created, temporarily create one
cmGlobalGenerator* gg = this->GetGlobalGenerator();
@@ -480,7 +478,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
}
// read in the list file to fill the cache
- if (path) {
+ if (!path.empty()) {
this->CurrentSnapshot = this->State->Reset();
std::string homeDir = this->GetHomeDirectory();
std::string homeOutputDir = this->GetHomeOutputDirectory();
@@ -501,7 +499,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
mf.SetArgcArgv(args);
}
if (!mf.ReadListFile(path)) {
- cmSystemTools::Error("Error processing file: ", path);
+ cmSystemTools::Error("Error processing file: " + path);
}
this->SetHomeDirectory(homeDir);
this->SetHomeOutputDirectory(homeOutputDir);
@@ -1608,14 +1606,14 @@ void cmake::PreLoadCMakeFiles()
if (!pre_load.empty()) {
pre_load += "/PreLoad.cmake";
if (cmSystemTools::FileExists(pre_load)) {
- this->ReadListFile(args, pre_load.c_str());
+ this->ReadListFile(args, pre_load);
}
}
pre_load = this->GetHomeOutputDirectory();
if (!pre_load.empty()) {
pre_load += "/PreLoad.cmake";
if (cmSystemTools::FileExists(pre_load)) {
- this->ReadListFile(args, pre_load.c_str());
+ this->ReadListFile(args, pre_load);
}
}
}
@@ -1922,17 +1920,15 @@ bool cmake::DeleteCache(const std::string& path)
return this->State->DeleteCache(path);
}
-void cmake::SetProgressCallback(ProgressCallbackType f, void* cd)
+void cmake::SetProgressCallback(ProgressCallbackType f)
{
- this->ProgressCallback = f;
- this->ProgressCallbackClientData = cd;
+ this->ProgressCallback = std::move(f);
}
void cmake::UpdateProgress(const char* msg, float prog)
{
if (this->ProgressCallback && !this->State->GetIsInTryCompile()) {
- (*this->ProgressCallback)(msg, prog, this->ProgressCallbackClientData);
- return;
+ this->ProgressCallback(msg, prog);
}
}
@@ -2358,7 +2354,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
outFile += "/CMakeLists.txt";
// Copy file
- if (!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str())) {
+ if (!cmSystemTools::cmCopyFile(inFile, outFile)) {
std::cerr << "Error copying file \"" << inFile << "\" to \"" << outFile
<< "\".\n";
return 1;
@@ -2617,7 +2613,7 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target,
cachePath + "/" + "CMakeFiles/" + "VerifyGlobs.cmake";
if (cmSystemTools::FileExists(globVerifyScript)) {
std::vector<std::string> args;
- this->ReadListFile(args, globVerifyScript.c_str());
+ this->ReadListFile(args, globVerifyScript);
}
}
diff --git a/Source/cmake.h b/Source/cmake.h
index c60fc33..53d44f1 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <functional>
#include <map>
#include <memory> // IWYU pragma: keep
#include <set>
@@ -59,8 +60,6 @@ struct cmDocumentationEntry;
class cmake
{
- CM_DISABLE_COPY(cmake)
-
public:
enum Role
{
@@ -119,6 +118,9 @@ public:
/// Destructor
~cmake();
+ cmake(cmake const&) = delete;
+ cmake& operator=(cmake const&) = delete;
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
Json::Value ReportVersionJson() const;
Json::Value ReportCapabilitiesJson(bool haveServerMode) const;
@@ -271,7 +273,7 @@ public:
///! Parse command line arguments that might set cache values
bool SetCacheArgs(const std::vector<std::string>&);
- typedef void (*ProgressCallbackType)(const char* msg, float progress, void*);
+ using ProgressCallbackType = std::function<void(const char*, float)>;
/**
* Set the function used by GUIs to receive progress updates
* Function gets passed: message as a const char*, a progress
@@ -279,7 +281,7 @@ public:
* number provided may be negative in cases where a message is
* to be displayed without any progress percentage.
*/
- void SetProgressCallback(ProgressCallbackType f, void* clientData = nullptr);
+ void SetProgressCallback(ProgressCallbackType f);
///! this is called by generators to update the progress
void UpdateProgress(const char* msg, float prog);
@@ -442,7 +444,6 @@ public:
protected:
void RunCheckForUnusedVariables();
- void InitializeProperties();
int HandleDeleteCacheVariables(const std::string& var);
typedef std::vector<cmGlobalGeneratorFactory*> RegisteredGeneratorsVector;
@@ -462,7 +463,8 @@ protected:
std::string GeneratorToolset;
///! read in a cmake list file to initialize the cache
- void ReadListFile(const std::vector<std::string>& args, const char* path);
+ void ReadListFile(const std::vector<std::string>& args,
+ const std::string& path);
bool FindPackage(const std::vector<std::string>& args);
///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
@@ -485,8 +487,6 @@ protected:
private:
ProgressCallbackType ProgressCallback;
- void* ProgressCallbackClientData;
- bool InTryCompile;
WorkingMode CurrentWorkingMode;
bool DebugOutput;
bool Trace;
@@ -534,18 +534,6 @@ private:
void AppendGlobalGeneratorsDocumentation(std::vector<cmDocumentationEntry>&);
void AppendExtraGeneratorsDocumentation(std::vector<cmDocumentationEntry>&);
-
- /**
- * Convert a message type between a warning and an error, based on the state
- * of the error output CMake variables, in the cache.
- */
- MessageType ConvertMessageType(MessageType t) const;
-
- /*
- * Check if messages of this type should be output, based on the state of the
- * warning and error output CMake variables, in the cache.
- */
- bool IsMessageTypeVisible(MessageType t) const;
};
#define CMAKE_STANDARD_OPTIONS_TABLE \
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 0ec2552..890b74e 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -117,9 +117,8 @@ int do_cmake(int ac, char const* const* av);
static int do_build(int ac, char const* const* av);
static int do_open(int ac, char const* const* av);
-static cmMakefile* cmakemainGetMakefile(void* clientdata)
+static cmMakefile* cmakemainGetMakefile(cmake* cm)
{
- cmake* cm = static_cast<cmake*>(clientdata);
if (cm && cm->GetDebugOutput()) {
cmGlobalGenerator* gg = cm->GetGlobalGenerator();
if (gg) {
@@ -129,10 +128,10 @@ static cmMakefile* cmakemainGetMakefile(void* clientdata)
return nullptr;
}
-static std::string cmakemainGetStack(void* clientdata)
+static std::string cmakemainGetStack(cmake* cm)
{
std::string msg;
- cmMakefile* mf = cmakemainGetMakefile(clientdata);
+ cmMakefile* mf = cmakemainGetMakefile(cm);
if (mf) {
msg = mf->FormatListFileStack();
if (!msg.empty()) {
@@ -144,15 +143,14 @@ static std::string cmakemainGetStack(void* clientdata)
}
static void cmakemainMessageCallback(const char* m, const char* /*unused*/,
- bool& /*unused*/, void* clientdata)
+ cmake* cm)
{
- std::cerr << m << cmakemainGetStack(clientdata) << std::endl << std::flush;
+ std::cerr << m << cmakemainGetStack(cm) << std::endl << std::flush;
}
-static void cmakemainProgressCallback(const char* m, float prog,
- void* clientdata)
+static void cmakemainProgressCallback(const char* m, float prog, cmake* cm)
{
- cmMakefile* mf = cmakemainGetMakefile(clientdata);
+ cmMakefile* mf = cmakemainGetMakefile(cm);
std::string dir;
if ((mf) && (strstr(m, "Configuring") == m) && (prog < 0)) {
dir = " ";
@@ -163,8 +161,7 @@ static void cmakemainProgressCallback(const char* m, float prog,
}
if ((prog < 0) || (!dir.empty())) {
- std::cout << "-- " << m << dir << cmakemainGetStack(clientdata)
- << std::endl;
+ std::cout << "-- " << m << dir << cmakemainGetStack(cm) << std::endl;
}
std::cout.flush();
@@ -322,8 +319,12 @@ int do_cmake(int ac, char const* const* av)
cmake cm(role, mode);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
- cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm);
- cm.SetProgressCallback(cmakemainProgressCallback, &cm);
+ cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) {
+ cmakemainMessageCallback(msg, title, &cm);
+ });
+ cm.SetProgressCallback([&cm](const char* msg, float prog) {
+ cmakemainProgressCallback(msg, prog, &cm);
+ });
cm.SetWorkingMode(workingMode);
int res = cm.Run(args, view_only);
@@ -498,8 +499,12 @@ static int do_build(int ac, char const* const* av)
}
cmake cm(cmake::RoleInternal, cmState::Unknown);
- cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm);
- cm.SetProgressCallback(cmakemainProgressCallback, &cm);
+ cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) {
+ cmakemainMessageCallback(msg, title, &cm);
+ });
+ cm.SetProgressCallback([&cm](const char* msg, float prog) {
+ cmakemainProgressCallback(msg, prog, &cm);
+ });
return cm.Build(jobs, dir, target, config, nativeOptions, clean, verbose);
#endif
}
@@ -536,8 +541,12 @@ static int do_open(int ac, char const* const* av)
}
cmake cm(cmake::RoleInternal, cmState::Unknown);
- cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm);
- cm.SetProgressCallback(cmakemainProgressCallback, &cm);
+ cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) {
+ cmakemainMessageCallback(msg, title, &cm);
+ });
+ cm.SetProgressCallback([&cm](const char* msg, float prog) {
+ cmakemainProgressCallback(msg, prog, &cm);
+ });
return cm.Open(dir, false) ? 0 : 1;
#endif
}
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 2a3aedd..d20c5d2 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -482,8 +482,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// If error occurs we want to continue copying next files.
bool return_value = false;
for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
- if (!cmSystemTools::cmCopyFile(args[cc].c_str(),
- args.back().c_str())) {
+ if (!cmSystemTools::cmCopyFile(args[cc], args.back())) {
std::cerr << "Error copying file \"" << args[cc] << "\" to \""
<< args.back() << "\".\n";
return_value = true;
@@ -505,8 +504,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// If error occurs we want to continue copying next files.
bool return_value = false;
for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
- if (!cmSystemTools::CopyFileIfDifferent(args[cc].c_str(),
- args.back().c_str())) {
+ if (!cmSystemTools::CopyFileIfDifferent(args[cc], args.back())) {
std::cerr << "Error copying file (if different) from \"" << args[cc]
<< "\" to \"" << args.back() << "\".\n";
return_value = true;
@@ -1304,7 +1302,7 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link)
cmSystemTools::RemoveFile(link);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
- return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str());
+ return cmSystemTools::CopyFileAlways(file, link);
#else
std::string linktext = cmSystemTools::GetFilenameName(file);
return cmSystemTools::CreateSymlink(linktext, link);
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index b33aa80..e7da994 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -42,6 +42,10 @@
# SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR})
# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
#
+# KWSYS_CXX_STANDARD = A value for CMAKE_CXX_STANDARD within KWSys.
+# Set to empty string to use no default value.
+# KWSYS_CXX_COMPILE_FEATURES = target_compile_features arguments for KWSys.
+#
# Optional settings to setup install rules are as follows:
#
# KWSYS_INSTALL_BIN_DIR = The installation target directories into
@@ -82,25 +86,17 @@
# any outside mailing list and no documentation of the change will be
# written.
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR)
FOREACH(p
- CMP0022 # CMake 2.8, Define link interface - required by android_mk export
- CMP0025 # CMake 3.0, Compiler id for Apple Clang is now AppleClang.
- CMP0042 # CMake 3.0, MACOSX_RPATH is enabled by default.
- CMP0048 # CMake 3.0, Let the project command manage version variables.
CMP0056 # CMake 3.2, Honor link flags in try_compile() source-file signature.
CMP0063 # CMake 3.3, Honor visibility properties for all target types.
+ CMP0067 # CMake 3.8, Honor language standard in try_compile source-file signature.
CMP0069 # CMake 3.9, INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.
)
IF(POLICY ${p})
CMAKE_POLICY(SET ${p} NEW)
ENDIF()
ENDFOREACH()
-SET(CMAKE_LEGACY_CYGWIN_WIN32 0)
-
-IF(CMAKE_VERSION VERSION_LESS 3.0)
- SET(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE 0)
-ENDIF()
#-----------------------------------------------------------------------------
# If a namespace is not specified, use "kwsys" and enable testing.
@@ -121,6 +117,12 @@ SET_PROPERTY(DIRECTORY
"KWSYS_HEADER(%)=<${KWSYS_NAMESPACE}/%>"
)
+if(KWSYS_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD "${KWSYS_CXX_STANDARD}")
+elseif(NOT DEFINED CMAKE_CXX_STANDARD AND NOT DEFINED KWSYS_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 11)
+endif()
+
# Select library components.
IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
SET(KWSYS_ENABLE_C 1)
@@ -884,6 +886,8 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
${KWSYS_TARGET_INTERFACE})
TARGET_SOURCES(${KWSYS_TARGET_LINK} INTERFACE
$<TARGET_OBJECTS:${KWSYS_TARGET_OBJECT}>)
+ target_compile_features(${KWSYS_TARGET_OBJECT} PRIVATE ${KWSYS_CXX_COMPILE_FEATURES})
+ target_compile_features(${KWSYS_TARGET_INTERFACE} INTERFACE ${KWSYS_CXX_COMPILE_FEATURES})
ELSE()
SET(KWSYS_TARGET_INTERFACE ${KWSYS_NAMESPACE})
SET(KWSYS_TARGET_OBJECT ${KWSYS_NAMESPACE})
@@ -892,6 +896,7 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
SET(KWSYS_LINK_DEPENDENCY PUBLIC)
ADD_LIBRARY(${KWSYS_TARGET_INTERFACE} ${KWSYS_LIBRARY_TYPE}
${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS})
+ target_compile_features(${KWSYS_TARGET_INTERFACE} PUBLIC ${KWSYS_CXX_COMPILE_FEATURES})
ENDIF()
if (KWSYS_ALIAS_TARGET)
add_library(${KWSYS_ALIAS_TARGET} ALIAS ${KWSYS_TARGET_INTERFACE})
diff --git a/Source/kwsys/kwsysPlatformTests.cmake b/Source/kwsys/kwsysPlatformTests.cmake
index 5386a49..28d3f68 100644
--- a/Source/kwsys/kwsysPlatformTests.cmake
+++ b/Source/kwsys/kwsysPlatformTests.cmake
@@ -7,11 +7,16 @@ SET(KWSYS_PLATFORM_TEST_FILE_CXX kwsysPlatformTestsCXX.cxx)
MACRO(KWSYS_PLATFORM_TEST lang var description invert)
IF(NOT DEFINED ${var}_COMPILED)
MESSAGE(STATUS "${description}")
+ set(maybe_cxx_standard "")
+ if(CMAKE_VERSION VERSION_LESS 3.8 AND CMAKE_CXX_STANDARD)
+ set(maybe_cxx_standard "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}")
+ endif()
TRY_COMPILE(${var}_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}}
COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_TEST_DEFINES} ${KWSYS_PLATFORM_TEST_EXTRA_FLAGS}
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=${KWSYS_PLATFORM_TEST_LINK_LIBRARIES}"
+ ${maybe_cxx_standard}
OUTPUT_VARIABLE OUTPUT)
IF(${var}_COMPILED)
FILE(APPEND