[Cmake-commits] CMake branch, master, updated. v3.13.3-1203-gd366296

Kitware Robot kwrobot at kitware.com
Wed Jan 30 08:13:09 EST 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  d36629661197b4255da2a1864ce7ec016b415d24 (commit)
       via  c30f9b1cdefc2fa26d89bc692001a4f1050f6038 (commit)
       via  bcec7d0778eb87ea58d720d9e20710dc2cdfdab6 (commit)
       via  8ec149003e756d4a40f86b9025acb15f7ff82136 (commit)
       via  340e8a9c3db63cfe62382adc746e192d792fc9c6 (commit)
       via  f201c9257d4516fc4ff3f1e0fee0515b43a111dd (commit)
       via  8c92db829b41243790c7dcc5300227f591a727a8 (commit)
       via  c31b6e616d5c2d697696540ca2e8faf14160d2b0 (commit)
       via  bcee24aecc1eaf6615eac9f24ae06acdf38845d3 (commit)
       via  a57fcfa3e0989a74d1e1c6c24132e285cdace2b1 (commit)
       via  95ef818c7df5f8f92130f11cad0e9b72d470dcdc (commit)
      from  d21769d5ddad9a76c3f2c773b8be6961ad159af3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d36629661197b4255da2a1864ce7ec016b415d24
commit d36629661197b4255da2a1864ce7ec016b415d24
Merge: c30f9b1 f201c92
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 30 13:12:21 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 30 08:12:27 2019 -0500

    Merge topic 'vendor-docs'
    
    f201c9257d DOCS: put Flang in alphabetical order
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2879


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c30f9b1cdefc2fa26d89bc692001a4f1050f6038
commit c30f9b1cdefc2fa26d89bc692001a4f1050f6038
Merge: bcec7d0 8c92db8
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 30 13:10:19 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 30 08:10:27 2019 -0500

    Merge topic 'functional-callbacks'
    
    8c92db829b MessageCallback: Remove unused bool& argument
    bcee24aecc Use `std::function` for callbacks
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Acked-by: vvs31415 <vstakhovsky at fastmail.com>
    Acked-by: Daniel Pfeifer <daniel at pfeifer-mail.de>
    Merge-request: !2872


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcec7d0778eb87ea58d720d9e20710dc2cdfdab6
commit bcec7d0778eb87ea58d720d9e20710dc2cdfdab6
Merge: 8ec1490 c31b6e6
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 30 13:08:53 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 30 08:08:59 2019 -0500

    Merge topic 'copyfile-stdstring'
    
    c31b6e616d cmSystemTools: copy file member functions accept std::string params
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2877


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8ec149003e756d4a40f86b9025acb15f7ff82136
commit 8ec149003e756d4a40f86b9025acb15f7ff82136
Merge: 340e8a9 95ef818
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 30 13:07:14 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 30 08:07:22 2019 -0500

    Merge topic 'UseJava-if-cleanup'
    
    95ef818c7d UseJava: clean-up if() expressions
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2871


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=340e8a9c3db63cfe62382adc746e192d792fc9c6
commit 340e8a9c3db63cfe62382adc746e192d792fc9c6
Merge: d21769d a57fcfa
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 30 08:05:10 2019 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jan 30 08:05:10 2019 -0500

    Merge branch 'release-3.13'


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f201c9257d4516fc4ff3f1e0fee0515b43a111dd
commit f201c9257d4516fc4ff3f1e0fee0515b43a111dd
Author:     Michael Hirsch, Ph.D <scivision at users.noreply.github.com>
AuthorDate: Tue Jan 29 13:30:55 2019 -0500
Commit:     Michael Hirsch, Ph.D <scivision at users.noreply.github.com>
CommitDate: Tue Jan 29 13:30:55 2019 -0500

    DOCS: put Flang in alphabetical order

diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
index 033e81c..5323880 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
@@ -17,6 +17,7 @@ include:
   Clang = LLVM Clang (clang.llvm.org)
   Cray = Cray Compiler (cray.com)
   Embarcadero, Borland = Embarcadero (embarcadero.com)
+  Flang = Flang LLVM Fortran Compiler
   G95 = G95 Fortran (g95.org)
   GNU = GNU Compiler Collection (gcc.gnu.org)
   GHS = Green Hills Software (www.ghs.com)
@@ -28,7 +29,6 @@ include:
   NVIDIA = NVIDIA CUDA Compiler (nvidia.com)
   OpenWatcom = Open Watcom (openwatcom.org)
   PGI = The Portland Group (pgroup.com)
-  Flang = Flang Fortran Compiler
   PathScale = PathScale (pathscale.com)
   SDCC = Small Device C Compiler (sdcc.sourceforge.net)
   SunPro = Oracle Solaris Studio (oracle.com)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c92db829b41243790c7dcc5300227f591a727a8
commit 8c92db829b41243790c7dcc5300227f591a727a8
Author:     Regina Pfeifer <regina at mailbox.org>
AuthorDate: Tue Jan 29 15:57:24 2019 +0100
Commit:     Regina Pfeifer <regina at mailbox.org>
CommitDate: Tue Jan 29 16:35:53 2019 +0100

    MessageCallback: Remove unused bool& argument

diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index d6f0d18..38aa1b3 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -118,7 +118,7 @@ public:
     : CM(cm)
   {
     cmSystemTools::SetMessageCallback(
-      [&s](const char* msg, const char* /*unused*/, bool& /*unused*/) {
+      [&s](const char* msg, const char* /*unused*/) {
         s += msg;
         s += "\n";
       });
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 82295b7..f2982a6 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -150,7 +150,7 @@ int main(int argc, char const* const* argv)
   }
 
   cmSystemTools::SetMessageCallback(
-    [myform](const char* message, const char* title, bool& /*unused*/) {
+    [myform](const char* message, const char* title) {
       myform->AddError(message, title);
     });
 
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 8c71cc0..065d610 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -25,8 +25,8 @@ QCMake::QCMake(QObject* p)
   cmSystemTools::SetRunCommandHideConsole(true);
 
   cmSystemTools::SetMessageCallback(
-    [this](const char* msg, const char* title, bool& cancel) {
-      this->messageCallback(msg, title, cancel);
+    [this](const char* msg, const char* title) {
+      this->messageCallback(msg, title);
     });
   cmSystemTools::SetStdoutCallback(
     [this](const char* msg, size_t len) { this->stdoutCallback(msg, len); });
@@ -359,8 +359,7 @@ void QCMake::progressCallback(const char* msg, float percent)
   QCoreApplication::processEvents();
 }
 
-void QCMake::messageCallback(const char* msg, const char* /*title*/,
-                             bool& /*stop*/)
+void QCMake::messageCallback(const char* msg, const char* /*title*/)
 {
   emit this->errorMessage(QString::fromLocal8Bit(msg));
   QCoreApplication::processEvents();
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index ad85630..4f22505 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -169,7 +169,7 @@ protected:
 
   bool interruptCallback();
   void progressCallback(const char* msg, float percent);
-  void messageCallback(const char* msg, const char* title, bool&);
+  void messageCallback(const char* msg, const char* title);
   void stdoutCallback(const char* msg, size_t len);
   void stderrCallback(const char* msg, size_t len);
 
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 44826fa..e740c05 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -97,8 +97,8 @@ void cmServer::ProcessRequest(cmConnection* connection,
   }
 
   cmSystemTools::SetMessageCallback(
-    [&request](const char* msg, const char* title, bool& cancel) {
-      reportMessage(msg, title, cancel, request);
+    [&request](const char* msg, const char* title) {
+      reportMessage(msg, title, request);
     });
 
   if (this->Protocol) {
@@ -166,7 +166,7 @@ void cmServer::reportProgress(const char* msg, float progress,
 }
 
 void cmServer::reportMessage(const char* msg, const char* title,
-                             bool& /*cancel*/, const cmServerRequest& request)
+                             const cmServerRequest& request)
 {
   assert(msg);
   std::string titleString;
diff --git a/Source/cmServer.h b/Source/cmServer.h
index 10588a0..bedf97f 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -120,7 +120,7 @@ public:
 private:
   static void reportProgress(const char* msg, float progress,
                              const cmServerRequest& request);
-  static void reportMessage(const char* msg, const char* title, bool& cancel,
+  static void reportMessage(const char* msg, const char* title,
                             const cmServerRequest& request);
 
   // Handle requests:
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index f660b39..7f00ba6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -329,7 +329,7 @@ void cmSystemTools::Message(const char* m1, const char* title)
     return;
   }
   if (s_MessageCallback) {
-    s_MessageCallback(m1, title, s_DisableMessages);
+    s_MessageCallback(m1, title);
     return;
   }
   std::cerr << m1 << std::endl << std::flush;
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 754929d..bada4e3 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -56,12 +56,11 @@ public:
    */
   static std::string TrimWhitespace(const std::string& s);
 
-  using MessageCallback = std::function<void(const char*, const char*, bool&)>;
+  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);
 
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index f1a223b..890b74e 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -143,7 +143,7 @@ static std::string cmakemainGetStack(cmake* cm)
 }
 
 static void cmakemainMessageCallback(const char* m, const char* /*unused*/,
-                                     bool& /*unused*/, cmake* cm)
+                                     cmake* cm)
 {
   std::cerr << m << cmakemainGetStack(cm) << std::endl << std::flush;
 }
@@ -319,10 +319,9 @@ int do_cmake(int ac, char const* const* av)
   cmake cm(role, mode);
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
-  cmSystemTools::SetMessageCallback(
-    [&cm](const char* msg, const char* title, bool& cancel) {
-      cmakemainMessageCallback(msg, title, cancel, &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);
   });
@@ -500,10 +499,9 @@ static int do_build(int ac, char const* const* av)
   }
 
   cmake cm(cmake::RoleInternal, cmState::Unknown);
-  cmSystemTools::SetMessageCallback(
-    [&cm](const char* msg, const char* title, bool& cancel) {
-      cmakemainMessageCallback(msg, title, cancel, &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);
   });
@@ -543,10 +541,9 @@ static int do_open(int ac, char const* const* av)
   }
 
   cmake cm(cmake::RoleInternal, cmState::Unknown);
-  cmSystemTools::SetMessageCallback(
-    [&cm](const char* msg, const char* title, bool& cancel) {
-      cmakemainMessageCallback(msg, title, cancel, &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);
   });

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c31b6e616d5c2d697696540ca2e8faf14160d2b0
commit c31b6e616d5c2d697696540ca2e8faf14160d2b0
Author:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Tue Jan 29 10:34:18 2019 -0500
Commit:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
CommitDate: Tue Jan 29 10:34:18 2019 -0500

    cmSystemTools: copy file member functions accept std::string params
    
    Cleaned up `c_str()`s.
    `cmSystemTools::CopyFileIfDifferent()` removed as redundant.

diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 8f492af..f12a452 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -288,8 +288,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 be4a18e..c55b148 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -212,8 +212,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..90d38fc 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -392,8 +392,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,
@@ -1077,8 +1076,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/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index afb0b2a..76c5b9a 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -3759,8 +3759,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/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/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9bd3b01..6b58f86 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3750,8 +3750,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 {
@@ -3802,8 +3801,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/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index f7de3aa..9c4afec 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -940,17 +940,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..98ada60 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -179,8 +179,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).  */
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/cmake.cxx b/Source/cmake.cxx
index 70316f1..b03ffdb 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2358,7 +2358,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;
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);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcee24aecc1eaf6615eac9f24ae06acdf38845d3
commit bcee24aecc1eaf6615eac9f24ae06acdf38845d3
Author:     Regina Pfeifer <regina at mailbox.org>
AuthorDate: Fri Jan 25 21:31:33 2019 +0100
Commit:     Regina Pfeifer <regina at mailbox.org>
CommitDate: Tue Jan 29 16:32:52 2019 +0100

    Use `std::function` for callbacks

diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 4728f69..3309e1b 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;
@@ -696,7 +690,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);
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..d6f0d18 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,30 @@ 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*/, bool& /*unused*/) {
+        s += msg;
+        s += "\n";
+      });
+
+    cmSystemTools::SetStdoutCallback(
+      [&s](const char* m, size_t len) { s.append(m, len); });
+
+    cmSystemTools::SetStderrCallback(
+      [&s](const char* m, size_t len) { s.append(m, len); });
+
+    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 b949023..efc335a 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -265,15 +265,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
@@ -299,7 +290,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..82295b7 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, bool& /*unused*/) {
+      myform->AddError(message, title);
+    });
 
   cmCursesForm::CurrentForm = myform;
 
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..88864bc 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -101,8 +101,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/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 2eecce6..8c71cc0 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, bool& cancel) {
+      this->messageCallback(msg, title, cancel);
+    });
+  cmSystemTools::SetStdoutCallback(
+    [this](const char* msg, size_t len) { this->stdoutCallback(msg, len); });
+  cmSystemTools::SetStderrCallback(
+    [this](const char* msg, size_t len) { this->stderrCallback(msg, len); });
 
   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,41 @@ 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)
+                             bool& /*stop*/)
 {
-  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(const char* msg, size_t len)
 {
-  QCMake* self = reinterpret_cast<QCMake*>(cd);
-  emit self->outputMessage(QString::fromLocal8Bit(msg, int(len)));
+  emit this->outputMessage(QString::fromLocal8Bit(msg, int(len)));
   QCoreApplication::processEvents();
 }
 
-void QCMake::stderrCallback(const char* msg, size_t len, void* cd)
+void QCMake::stderrCallback(const char* msg, size_t len)
 {
-  QCMake* self = reinterpret_cast<QCMake*>(cd);
-  emit self->outputMessage(QString::fromLocal8Bit(msg, int(len)));
+  emit this->outputMessage(QString::fromLocal8Bit(msg, int(len)));
   QCoreApplication::processEvents();
 }
 
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index c84da58..ad85630 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, bool&);
+  void stdoutCallback(const char* msg, size_t len);
+  void stderrCallback(const char* msg, size_t len);
+
   bool WarnUninitializedMode;
   bool WarnUnusedMode;
   bool WarnUnusedAllMode;
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index f7d3879..44826fa 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, bool& cancel) {
+      reportMessage(msg, title, cancel, 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)
+                             bool& /*cancel*/, 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..10588a0 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -118,9 +118,10 @@ public:
   void OnConnected(cmConnection* connection) override;
 
 private:
-  static void reportProgress(const char* msg, float progress, void* data);
+  static void reportProgress(const char* msg, float progress,
+                             const cmServerRequest& request);
   static void reportMessage(const char* msg, const char* title, bool& cancel,
-                            void* data);
+                            const cmServerRequest& request);
 
   // Handle requests:
   cmServerResponse SetProtocolVersion(const cmServerRequest& request);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index f7de3aa..f660b39 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.c_str(), s.length());
   } 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.c_str(), s.length());
   } 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, s_DisableMessages);
     return;
   }
   std::cerr << m1 << std::endl << std::flush;
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index b1d5751..754929d 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,14 @@ 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*, bool&)>;
   /**
    *  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).
    */
-  static void SetMessageCallback(MessageCallback f,
-                                 void* clientData = nullptr);
+  static void SetMessageCallback(MessageCallback f);
 
   /**
    * Display an error message.
@@ -81,19 +81,18 @@ public:
     Message(m.c_str(), title);
   }
 
-  typedef void (*OutputCallback)(const char*, size_t length, void*);
+  using OutputCallback = std::function<void(const char*, size_t)>;
 
   ///! 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.
@@ -548,14 +547,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/cmake.cxx b/Source/cmake.cxx
index 70316f1..787e769 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
@@ -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);
   }
 }
 
diff --git a/Source/cmake.h b/Source/cmake.h
index c60fc33..afd4117 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>
@@ -271,7 +272,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 +280,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);
@@ -485,7 +486,6 @@ protected:
 
 private:
   ProgressCallbackType ProgressCallback;
-  void* ProgressCallbackClientData;
   bool InTryCompile;
   WorkingMode CurrentWorkingMode;
   bool DebugOutput;
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 0ec2552..f1a223b 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)
+                                     bool& /*unused*/, 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,13 @@ 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, bool& cancel) {
+      cmakemainMessageCallback(msg, title, cancel, &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 +500,13 @@ 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, bool& cancel) {
+      cmakemainMessageCallback(msg, title, cancel, &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 +543,13 @@ 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, bool& cancel) {
+      cmakemainMessageCallback(msg, title, cancel, &cm);
+    });
+  cm.SetProgressCallback([&cm](const char* msg, float prog) {
+    cmakemainProgressCallback(msg, prog, &cm);
+  });
   return cm.Open(dir, false) ? 0 : 1;
 #endif
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95ef818c7df5f8f92130f11cad0e9b72d470dcdc
commit 95ef818c7df5f8f92130f11cad0e9b72d470dcdc
Author:     Marc Chevrier <marc.chevrier at gmail.com>
AuthorDate: Mon Jan 28 18:43:50 2019 +0100
Commit:     Marc Chevrier <marc.chevrier at gmail.com>
CommitDate: Mon Jan 28 18:43:50 2019 +0100

    UseJava: clean-up if() expressions
    
    Fixes: #18836

diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 2bcd28e..5600b4c 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -446,7 +446,7 @@ function (__java_copy_file src dest comment)
 endfunction ()
 
 function(__java_lcat VAR)
-    foreach(_line ${ARGN})
+    foreach(_line IN LISTS ARGN)
         string(APPEND ${VAR} "${_line}\n")
     endforeach()
 
@@ -568,7 +568,7 @@ function(add_jar _TARGET_NAME)
         set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
     endif()
 
-    foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH})
+    foreach (JAVA_INCLUDE_DIR IN LISTS CMAKE_JAVA_INCLUDE_PATH)
        string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
     endforeach()
 
@@ -592,7 +592,7 @@ function(add_jar _TARGET_NAME)
     set(_JAVA_COMPILE_DEPENDS)
     set(_JAVA_RESOURCE_FILES)
     set(_JAVA_RESOURCE_FILES_RELATIVE)
-    foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES})
+    foreach(_JAVA_SOURCE_FILE IN LISTS _JAVA_SOURCE_FILES)
         get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT)
         get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE)
         get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
@@ -607,7 +607,7 @@ function(add_jar _TARGET_NAME)
             file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
             string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
             string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
-            if (${_BIN_LEN} LESS ${_SRC_LEN})
+            if (_BIN_LEN LESS _SRC_LEN)
                 set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH})
             else ()
                 set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH})
@@ -637,7 +637,7 @@ function(add_jar _TARGET_NAME)
         endif ()
     endforeach()
 
-    foreach(_JAVA_INCLUDE_JAR ${_add_jar_INCLUDE_JARS})
+    foreach(_JAVA_INCLUDE_JAR IN LISTS _add_jar_INCLUDE_JARS)
         if (TARGET ${_JAVA_INCLUDE_JAR})
             get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE)
             if (_JAVA_JAR_PATH)
@@ -705,7 +705,7 @@ function(add_jar _TARGET_NAME)
 
     # create the jar file
     set(_JAVA_JAR_OUTPUT_PATH
-      ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME})
+      "${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}")
     if (CMAKE_JNI_TARGET)
         add_custom_command(
             OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
@@ -903,15 +903,15 @@ function (find_jar VARIABLE)
 
     set(_state "name")
 
-    foreach (arg ${ARGN})
-        if (${_state} STREQUAL "name")
-            if (${arg} STREQUAL "VERSIONS")
+    foreach (arg IN LISTS ARGN)
+        if (_state STREQUAL "name")
+            if (arg STREQUAL "VERSIONS")
                 set(_state "versions")
-            elseif (${arg} STREQUAL "NAMES")
+            elseif (arg STREQUAL "NAMES")
                 set(_state "names")
-            elseif (${arg} STREQUAL "PATHS")
+            elseif (arg STREQUAL "PATHS")
                 set(_state "paths")
-            elseif (${arg} STREQUAL "DOC")
+            elseif (arg STREQUAL "DOC")
                 set(_state "doc")
             else ()
                 set(_jar_names ${arg})
@@ -919,22 +919,22 @@ function (find_jar VARIABLE)
                     set(_jar_doc "Finding ${arg} jar")
                 endif ()
             endif ()
-        elseif (${_state} STREQUAL "versions")
-            if (${arg} STREQUAL "NAMES")
+        elseif (_state STREQUAL "versions")
+            if (arg STREQUAL "NAMES")
                 set(_state "names")
-            elseif (${arg} STREQUAL "PATHS")
+            elseif (arg STREQUAL "PATHS")
                 set(_state "paths")
-            elseif (${arg} STREQUAL "DOC")
+            elseif (arg STREQUAL "DOC")
                 set(_state "doc")
             else ()
                 set(_jar_versions ${_jar_versions} ${arg})
             endif ()
-        elseif (${_state} STREQUAL "names")
-            if (${arg} STREQUAL "VERSIONS")
+        elseif (_state STREQUAL "names")
+            if (arg STREQUAL "VERSIONS")
                 set(_state "versions")
-            elseif (${arg} STREQUAL "PATHS")
+            elseif (arg STREQUAL "PATHS")
                 set(_state "paths")
-            elseif (${arg} STREQUAL "DOC")
+            elseif (arg STREQUAL "DOC")
                 set(_state "doc")
             else ()
                 set(_jar_names ${_jar_names} ${arg})
@@ -942,22 +942,22 @@ function (find_jar VARIABLE)
                     set(_jar_doc "Finding ${arg} jar")
                 endif ()
             endif ()
-        elseif (${_state} STREQUAL "paths")
-            if (${arg} STREQUAL "VERSIONS")
+        elseif (_state STREQUAL "paths")
+            if (arg STREQUAL "VERSIONS")
                 set(_state "versions")
-            elseif (${arg} STREQUAL "NAMES")
+            elseif (arg STREQUAL "NAMES")
                 set(_state "names")
-            elseif (${arg} STREQUAL "DOC")
+            elseif (arg STREQUAL "DOC")
                 set(_state "doc")
             else ()
                 set(_jar_paths ${_jar_paths} ${arg})
             endif ()
-        elseif (${_state} STREQUAL "doc")
-            if (${arg} STREQUAL "VERSIONS")
+        elseif (_state STREQUAL "doc")
+            if (arg STREQUAL "VERSIONS")
                 set(_state "versions")
-            elseif (${arg} STREQUAL "NAMES")
+            elseif (arg STREQUAL "NAMES")
                 set(_state "names")
-            elseif (${arg} STREQUAL "PATHS")
+            elseif (arg STREQUAL "PATHS")
                 set(_state "paths")
             else ()
                 set(_jar_doc ${arg})
@@ -969,8 +969,8 @@ function (find_jar VARIABLE)
         message(FATAL_ERROR "find_jar: No name to search for given")
     endif ()
 
-    foreach (jar_name ${_jar_names})
-        foreach (version ${_jar_versions})
+    foreach (jar_name IN LISTS _jar_names)
+        foreach (version IN LISTS _jar_versions)
             set(_jar_files ${_jar_files} ${jar_name}-${version}.jar)
         endforeach ()
         set(_jar_files ${_jar_files} ${jar_name}.jar)
@@ -997,252 +997,252 @@ function(create_javadoc _target)
 
     set(_state "package")
 
-    foreach (arg ${ARGN})
-        if (${_state} STREQUAL "package")
-            if (${arg} STREQUAL "PACKAGES")
+    foreach (arg IN LISTS ARGN)
+        if (_state STREQUAL "package")
+            if (arg STREQUAL "PACKAGES")
                 set(_state "packages")
-            elseif (${arg} STREQUAL "FILES")
+            elseif (arg STREQUAL "FILES")
                 set(_state "files")
-            elseif (${arg} STREQUAL "SOURCEPATH")
+            elseif (arg STREQUAL "SOURCEPATH")
                 set(_state "sourcepath")
-            elseif (${arg} STREQUAL "CLASSPATH")
+            elseif (arg STREQUAL "CLASSPATH")
                 set(_state "classpath")
-            elseif (${arg} STREQUAL "INSTALLPATH")
+            elseif (arg STREQUAL "INSTALLPATH")
                 set(_state "installpath")
-            elseif (${arg} STREQUAL "DOCTITLE")
+            elseif (arg STREQUAL "DOCTITLE")
                 set(_state "doctitle")
-            elseif (${arg} STREQUAL "WINDOWTITLE")
+            elseif (arg STREQUAL "WINDOWTITLE")
                 set(_state "windowtitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 set(_javadoc_packages ${arg})
                 set(_state "packages")
             endif ()
-        elseif (${_state} STREQUAL "packages")
-            if (${arg} STREQUAL "FILES")
+        elseif (_state STREQUAL "packages")
+            if (arg STREQUAL "FILES")
                 set(_state "files")
-            elseif (${arg} STREQUAL "SOURCEPATH")
+            elseif (arg STREQUAL "SOURCEPATH")
                 set(_state "sourcepath")
-            elseif (${arg} STREQUAL "CLASSPATH")
+            elseif (arg STREQUAL "CLASSPATH")
                 set(_state "classpath")
-            elseif (${arg} STREQUAL "INSTALLPATH")
+            elseif (arg STREQUAL "INSTALLPATH")
                 set(_state "installpath")
-            elseif (${arg} STREQUAL "DOCTITLE")
+            elseif (arg STREQUAL "DOCTITLE")
                 set(_state "doctitle")
-            elseif (${arg} STREQUAL "WINDOWTITLE")
+            elseif (arg STREQUAL "WINDOWTITLE")
                 set(_state "windowtitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 list(APPEND _javadoc_packages ${arg})
             endif ()
-        elseif (${_state} STREQUAL "files")
-            if (${arg} STREQUAL "PACKAGES")
+        elseif (_state STREQUAL "files")
+            if (arg STREQUAL "PACKAGES")
                 set(_state "packages")
-            elseif (${arg} STREQUAL "SOURCEPATH")
+            elseif (arg STREQUAL "SOURCEPATH")
                 set(_state "sourcepath")
-            elseif (${arg} STREQUAL "CLASSPATH")
+            elseif (arg STREQUAL "CLASSPATH")
                 set(_state "classpath")
-            elseif (${arg} STREQUAL "INSTALLPATH")
+            elseif (arg STREQUAL "INSTALLPATH")
                 set(_state "installpath")
-            elseif (${arg} STREQUAL "DOCTITLE")
+            elseif (arg STREQUAL "DOCTITLE")
                 set(_state "doctitle")
-            elseif (${arg} STREQUAL "WINDOWTITLE")
+            elseif (arg STREQUAL "WINDOWTITLE")
                 set(_state "windowtitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 list(APPEND _javadoc_files ${arg})
             endif ()
-        elseif (${_state} STREQUAL "sourcepath")
-            if (${arg} STREQUAL "PACKAGES")
+        elseif (_state STREQUAL "sourcepath")
+            if (arg STREQUAL "PACKAGES")
                 set(_state "packages")
-            elseif (${arg} STREQUAL "FILES")
+            elseif (arg STREQUAL "FILES")
                 set(_state "files")
-            elseif (${arg} STREQUAL "CLASSPATH")
+            elseif (arg STREQUAL "CLASSPATH")
                 set(_state "classpath")
-            elseif (${arg} STREQUAL "INSTALLPATH")
+            elseif (arg STREQUAL "INSTALLPATH")
                 set(_state "installpath")
-            elseif (${arg} STREQUAL "DOCTITLE")
+            elseif (arg STREQUAL "DOCTITLE")
                 set(_state "doctitle")
-            elseif (${arg} STREQUAL "WINDOWTITLE")
+            elseif (arg STREQUAL "WINDOWTITLE")
                 set(_state "windowtitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 list(APPEND _javadoc_sourcepath ${arg})
             endif ()
-        elseif (${_state} STREQUAL "classpath")
-            if (${arg} STREQUAL "PACKAGES")
+        elseif (_state STREQUAL "classpath")
+            if (arg STREQUAL "PACKAGES")
                 set(_state "packages")
-            elseif (${arg} STREQUAL "FILES")
+            elseif (arg STREQUAL "FILES")
                 set(_state "files")
-            elseif (${arg} STREQUAL "SOURCEPATH")
+            elseif (arg STREQUAL "SOURCEPATH")
                 set(_state "sourcepath")
-            elseif (${arg} STREQUAL "INSTALLPATH")
+            elseif (arg STREQUAL "INSTALLPATH")
                 set(_state "installpath")
-            elseif (${arg} STREQUAL "DOCTITLE")
+            elseif (arg STREQUAL "DOCTITLE")
                 set(_state "doctitle")
-            elseif (${arg} STREQUAL "WINDOWTITLE")
+            elseif (arg STREQUAL "WINDOWTITLE")
                 set(_state "windowtitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 list(APPEND _javadoc_classpath ${arg})
             endif ()
-        elseif (${_state} STREQUAL "installpath")
-            if (${arg} STREQUAL "PACKAGES")
+        elseif (_state STREQUAL "installpath")
+            if (arg STREQUAL "PACKAGES")
                 set(_state "packages")
-            elseif (${arg} STREQUAL "FILES")
+            elseif (arg STREQUAL "FILES")
                 set(_state "files")
-            elseif (${arg} STREQUAL "SOURCEPATH")
+            elseif (arg STREQUAL "SOURCEPATH")
                 set(_state "sourcepath")
-            elseif (${arg} STREQUAL "DOCTITLE")
+            elseif (arg STREQUAL "DOCTITLE")
                 set(_state "doctitle")
-            elseif (${arg} STREQUAL "WINDOWTITLE")
+            elseif (arg STREQUAL "WINDOWTITLE")
                 set(_state "windowtitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 set(_javadoc_installpath ${arg})
             endif ()
-        elseif (${_state} STREQUAL "doctitle")
+        elseif (_state STREQUAL "doctitle")
             if (${arg} STREQUAL "PACKAGES")
                 set(_state "packages")
-            elseif (${arg} STREQUAL "FILES")
+            elseif (arg STREQUAL "FILES")
                 set(_state "files")
-            elseif (${arg} STREQUAL "SOURCEPATH")
+            elseif (arg STREQUAL "SOURCEPATH")
                 set(_state "sourcepath")
-            elseif (${arg} STREQUAL "INSTALLPATH")
+            elseif (arg STREQUAL "INSTALLPATH")
                 set(_state "installpath")
-            elseif (${arg} STREQUAL "CLASSPATH")
+            elseif (arg STREQUAL "CLASSPATH")
                 set(_state "classpath")
-            elseif (${arg} STREQUAL "WINDOWTITLE")
+            elseif (arg STREQUAL "WINDOWTITLE")
                 set(_state "windowtitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 set(_javadoc_doctitle ${arg})
             endif ()
-        elseif (${_state} STREQUAL "windowtitle")
+        elseif (_state STREQUAL "windowtitle")
             if (${arg} STREQUAL "PACKAGES")
                 set(_state "packages")
-            elseif (${arg} STREQUAL "FILES")
+            elseif (arg STREQUAL "FILES")
                 set(_state "files")
-            elseif (${arg} STREQUAL "SOURCEPATH")
+            elseif (arg STREQUAL "SOURCEPATH")
                 set(_state "sourcepath")
-            elseif (${arg} STREQUAL "CLASSPATH")
+            elseif (arg STREQUAL "CLASSPATH")
                 set(_state "classpath")
-            elseif (${arg} STREQUAL "INSTALLPATH")
+            elseif (arg STREQUAL "INSTALLPATH")
                 set(_state "installpath")
-            elseif (${arg} STREQUAL "DOCTITLE")
+            elseif (arg STREQUAL "DOCTITLE")
                 set(_state "doctitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 set(_javadoc_windowtitle ${arg})
             endif ()
-        elseif (${_state} STREQUAL "author")
-            if (${arg} STREQUAL "PACKAGES")
+        elseif (_state STREQUAL "author")
+            if (arg STREQUAL "PACKAGES")
                 set(_state "packages")
-            elseif (${arg} STREQUAL "FILES")
+            elseif (arg STREQUAL "FILES")
                 set(_state "files")
-            elseif (${arg} STREQUAL "SOURCEPATH")
+            elseif (arg STREQUAL "SOURCEPATH")
                 set(_state "sourcepath")
-            elseif (${arg} STREQUAL "CLASSPATH")
+            elseif (arg STREQUAL "CLASSPATH")
                 set(_state "classpath")
-            elseif (${arg} STREQUAL "INSTALLPATH")
+            elseif (arg STREQUAL "INSTALLPATH")
                 set(_state "installpath")
-            elseif (${arg} STREQUAL "DOCTITLE")
+            elseif (arg STREQUAL "DOCTITLE")
                 set(_state "doctitle")
-            elseif (${arg} STREQUAL "WINDOWTITLE")
+            elseif (arg STREQUAL "WINDOWTITLE")
                 set(_state "windowtitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 set(_javadoc_author ${arg})
             endif ()
-        elseif (${_state} STREQUAL "use")
-            if (${arg} STREQUAL "PACKAGES")
+        elseif (_state STREQUAL "use")
+            if (arg STREQUAL "PACKAGES")
                 set(_state "packages")
-            elseif (${arg} STREQUAL "FILES")
+            elseif (arg STREQUAL "FILES")
                 set(_state "files")
-            elseif (${arg} STREQUAL "SOURCEPATH")
+            elseif (arg STREQUAL "SOURCEPATH")
                 set(_state "sourcepath")
-            elseif (${arg} STREQUAL "CLASSPATH")
+            elseif (arg STREQUAL "CLASSPATH")
                 set(_state "classpath")
-            elseif (${arg} STREQUAL "INSTALLPATH")
+            elseif (arg STREQUAL "INSTALLPATH")
                 set(_state "installpath")
-            elseif (${arg} STREQUAL "DOCTITLE")
+            elseif (arg STREQUAL "DOCTITLE")
                 set(_state "doctitle")
-            elseif (${arg} STREQUAL "WINDOWTITLE")
+            elseif (arg STREQUAL "WINDOWTITLE")
                 set(_state "windowtitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 set(_javadoc_use ${arg})
             endif ()
-        elseif (${_state} STREQUAL "version")
-            if (${arg} STREQUAL "PACKAGES")
+        elseif (_state STREQUAL "version")
+            if (arg STREQUAL "PACKAGES")
                 set(_state "packages")
-            elseif (${arg} STREQUAL "FILES")
+            elseif (arg STREQUAL "FILES")
                 set(_state "files")
-            elseif (${arg} STREQUAL "SOURCEPATH")
+            elseif (arg STREQUAL "SOURCEPATH")
                 set(_state "sourcepath")
-            elseif (${arg} STREQUAL "CLASSPATH")
+            elseif (arg STREQUAL "CLASSPATH")
                 set(_state "classpath")
-            elseif (${arg} STREQUAL "INSTALLPATH")
+            elseif (arg STREQUAL "INSTALLPATH")
                 set(_state "installpath")
-            elseif (${arg} STREQUAL "DOCTITLE")
+            elseif (arg STREQUAL "DOCTITLE")
                 set(_state "doctitle")
-            elseif (${arg} STREQUAL "WINDOWTITLE")
+            elseif (arg STREQUAL "WINDOWTITLE")
                 set(_state "windowtitle")
-            elseif (${arg} STREQUAL "AUTHOR")
+            elseif (arg STREQUAL "AUTHOR")
                 set(_state "author")
-            elseif (${arg} STREQUAL "USE")
+            elseif (arg STREQUAL "USE")
                 set(_state "use")
-            elseif (${arg} STREQUAL "VERSION")
+            elseif (arg STREQUAL "VERSION")
                 set(_state "version")
             else ()
                 set(_javadoc_version ${arg})
@@ -1255,7 +1255,7 @@ function(create_javadoc _target)
 
     if (_javadoc_sourcepath)
         set(_start TRUE)
-        foreach(_path ${_javadoc_sourcepath})
+        foreach(_path IN LISTS _javadoc_sourcepath)
             if (_start)
                 set(_sourcepath ${_path})
                 set(_start FALSE)
@@ -1268,7 +1268,7 @@ function(create_javadoc _target)
 
     if (_javadoc_classpath)
         set(_start TRUE)
-        foreach(_path ${_javadoc_classpath})
+        foreach(_path IN LISTS _javadoc_classpath)
             if (_start)
                 set(_classpath ${_path})
                 set(_start FALSE)
@@ -1435,7 +1435,7 @@ function(export_jars)
     # Set content of generated exports file
     string(REPLACE ";" " " __targets__ "${_export_jars_TARGETS}")
     set(__targetdefs__ "")
-    foreach(_target ${_export_jars_TARGETS})
+    foreach(_target IN LISTS _export_jars_TARGETS)
         get_target_property(_jarpath ${_target} JAR_FILE)
         get_filename_component(_jarpath ${_jarpath} PATH)
         __java_export_jar(__targetdefs__ ${_target} "${_jarpath}")
@@ -1473,7 +1473,7 @@ function(install_jar_exports)
     endif()
 
     # Determine relative path from installed export file to install prefix
-    if(IS_ABSOLUTE ${_install_jar_exports_DESTINATION})
+    if(IS_ABSOLUTE "${_install_jar_exports_DESTINATION}")
       file(RELATIVE_PATH _relpath
         ${_install_jar_exports_DESTINATION}
         ${CMAKE_INSTALL_PREFIX}
@@ -1492,7 +1492,7 @@ function(install_jar_exports)
     # Set content of generated exports file
     string(REPLACE ";" " " __targets__ "${_install_jar_exports_TARGETS}")
     set(__targetdefs__ "set(_prefix \${CMAKE_CURRENT_LIST_DIR}/${_relpath})\n\n")
-    foreach(_target ${_install_jar_exports_TARGETS})
+    foreach(_target IN LISTS _install_jar_exports_TARGETS)
         get_target_property(_dir ${_target} INSTALL_DESTINATION)
         __java_export_jar(__targetdefs__ ${_target} "\${_prefix}/${_dir}")
     endforeach()

-----------------------------------------------------------------------

Summary of changes:
 Help/variable/CMAKE_LANG_COMPILER_ID.rst    |   2 +-
 Modules/UseJava.cmake                       | 294 ++++++++++++++--------------
 Source/CPack/IFW/cmCPackIFWInstaller.cxx    |   3 +-
 Source/CPack/cmCPackDragNDropGenerator.cxx  |   3 +-
 Source/CPack/cmCPackGenerator.cxx           |  16 +-
 Source/CPack/cpack.cxx                      |   8 +-
 Source/CTest/cmCTestBuildAndTestHandler.cxx |  50 ++---
 Source/CTest/cmCTestScriptHandler.cxx       |  15 +-
 Source/CursesDialog/ccmake.cxx              |  12 +-
 Source/CursesDialog/cmCursesMainForm.cxx    |  22 +--
 Source/CursesDialog/cmCursesMainForm.h      |   3 +-
 Source/QtDialog/QCMake.cxx                  |  50 ++---
 Source/QtDialog/QCMake.h                    |  12 +-
 Source/cmFileCommand.cxx                    |   3 +-
 Source/cmGlobalVisualStudioGenerator.cxx    |   5 +-
 Source/cmMakefile.cxx                       |   6 +-
 Source/cmServer.cxx                         |  26 +--
 Source/cmServer.h                           |   7 +-
 Source/cmSystemTools.cxx                    |  56 +++---
 Source/cmSystemTools.h                      |  32 ++-
 Source/cmUseMangledMesaCommand.cxx          |   2 +-
 Source/cmake.cxx                            |  12 +-
 Source/cmake.h                              |   6 +-
 Source/cmakemain.cxx                        |  43 ++--
 Source/cmcmd.cxx                            |   8 +-
 25 files changed, 324 insertions(+), 372 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list