Browse Source

Merge topic 'simplify-and-clean-up-some-cpack-functions'

208b3f63ac CPackDeb.cmake: Fix debug message
48fc711064 cmLocalGenerator: Fix comments in generated cmake_install.cmake file
af1d166387 cmCPackGenerator: Fix debug message in function `PrepareGroupingKind`
a522abe5c0 cmCPackGenerator: Fix comment in function `InstallCMakeProject`
87cfe9dd91 cmCPackGenerator: Slightly simplify function `InstallProject`
1350ed96ff cmCPackGenerator: Clean up and simplify function `DoPackage`
d26eed4c75 cmCPackGenerator: Clean up and simplify function `PrepareNames`
12123b5b6b cmCPackGenerator: Refactor copying of package files into own function
...

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !9457
Brad King 1 year ago
parent
commit
e6d04030d1

+ 1 - 1
Modules/Internal/CPack/CPackDeb.cmake

@@ -487,7 +487,7 @@ function(cpack_deb_prepare_package_vars)
       if(DEFINED ${_component_var})
         set(CPACK_DEBIAN_PACKAGE_${value_type_} "${${_component_var}}")
         if(CPACK_DEBIAN_PACKAGE_DEBUG)
-          message("CPackDeb Debug: component '${_local_component_name}' ${value_type_} "
+          message("CPackDeb Debug: component '${CPACK_DEB_PACKAGE_COMPONENT}' ${value_type_} "
             "value set to '${CPACK_DEBIAN_PACKAGE_${value_type_}}'")
         endif()
       endif()

+ 143 - 106
Source/CPack/cmCPackGenerator.cxx

@@ -79,51 +79,60 @@ int cmCPackGenerator::PrepareNames()
     }
   }
 
-  std::string tempDirectory =
-    cmStrCat(this->GetOption("CPACK_PACKAGE_DIRECTORY"), "/_CPack_Packages/");
-  cmValue toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
-  if (toplevelTag) {
-    tempDirectory += *toplevelTag;
-    tempDirectory += "/";
-  }
-  tempDirectory += *this->GetOption("CPACK_GENERATOR");
-  std::string topDirectory = tempDirectory;
-  cmValue pfname = this->GetOption("CPACK_PACKAGE_FILE_NAME");
-  if (!pfname) {
+  // Determine package-directory.
+  cmValue pkgDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
+  if (!pkgDirectory) {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+                  "CPACK_PACKAGE_DIRECTORY not specified" << std::endl);
+    return 0;
+  }
+  // Determine base-filename of the package.
+  cmValue pkgBaseFileName = this->GetOption("CPACK_PACKAGE_FILE_NAME");
+  if (!pkgBaseFileName) {
     cmCPackLogger(cmCPackLog::LOG_ERROR,
                   "CPACK_PACKAGE_FILE_NAME not specified" << std::endl);
     return 0;
   }
-  std::string outName = *pfname;
-  tempDirectory += "/" + outName;
+  // Determine filename of the package.
   if (!this->GetOutputExtension()) {
     cmCPackLogger(cmCPackLog::LOG_ERROR,
                   "No output extension specified" << std::endl);
     return 0;
   }
-  outName += this->GetOutputExtension();
-  cmValue pdir = this->GetOption("CPACK_PACKAGE_DIRECTORY");
-  if (!pdir) {
-    cmCPackLogger(cmCPackLog::LOG_ERROR,
-                  "CPACK_PACKAGE_DIRECTORY not specified" << std::endl);
-    return 0;
+  std::string pkgFileName =
+    cmStrCat(pkgBaseFileName, this->GetOutputExtension());
+  // Determine path to the package.
+  std::string pkgFilePath = cmStrCat(pkgDirectory, "/", pkgFileName);
+  // Determine top-level directory for packaging.
+  std::string topDirectory = cmStrCat(pkgDirectory, "/_CPack_Packages/");
+  {
+    cmValue toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
+    if (toplevelTag) {
+      topDirectory += cmStrCat(toplevelTag, "/");
+    }
   }
+  topDirectory += *this->GetOption("CPACK_GENERATOR");
+  // Determine temporary packaging-directory.
+  std::string tmpDirectory = cmStrCat(topDirectory, "/", pkgBaseFileName);
+  // Determine path to temporary package file.
+  std::string tmpPkgFilePath = topDirectory + "/" + pkgFileName;
 
-  std::string destFile = *pdir;
-  this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PREFIX", destFile);
-  destFile += "/" + outName;
-  std::string outFile = topDirectory + "/" + outName;
+  // Set CPack variables which are not set already.
+  this->SetOptionIfNotSet("CPACK_REMOVE_TOPLEVEL_DIRECTORY", "1");
   this->SetOptionIfNotSet("CPACK_TOPLEVEL_DIRECTORY", topDirectory);
-  this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tempDirectory);
-  this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", outName);
-  this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PATH", destFile);
-  this->SetOptionIfNotSet("CPACK_TEMPORARY_PACKAGE_FILE_NAME", outFile);
+  this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tmpDirectory);
+  this->SetOptionIfNotSet("CPACK_TEMPORARY_INSTALL_DIRECTORY", tmpDirectory);
+  this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PREFIX", pkgDirectory);
+  this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", pkgFileName);
+  this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PATH", pkgFilePath);
+  this->SetOptionIfNotSet("CPACK_TEMPORARY_PACKAGE_FILE_NAME", tmpPkgFilePath);
   this->SetOptionIfNotSet("CPACK_INSTALL_DIRECTORY", this->GetInstallPath());
   this->SetOptionIfNotSet(
     "CPACK_NATIVE_INSTALL_DIRECTORY",
     cmsys::SystemTools::ConvertToOutputPath(this->GetInstallPath()));
-  this->SetOptionIfNotSet("CPACK_TEMPORARY_INSTALL_DIRECTORY", tempDirectory);
 
+  // Determine description of the package and set as CPack variable,
+  // if not already set.
   cmCPackLogger(cmCPackLog::LOG_DEBUG,
                 "Look for: CPACK_PACKAGE_DESCRIPTION_FILE" << std::endl);
   cmValue descFileName = this->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE");
@@ -143,14 +152,14 @@ int cmCPackGenerator::PrepareNames()
                                                           << std::endl);
       return 0;
     }
-    std::ostringstream ostr;
-    std::string line;
-
     cmCPackLogger(cmCPackLog::LOG_VERBOSE,
                   "Read description file: " << *descFileName << std::endl);
+    std::ostringstream ostr;
+    std::string line;
     while (ifs && cmSystemTools::GetLineFromStream(ifs, line)) {
       ostr << cmXMLSafe(line) << std::endl;
     }
+
     this->SetOption("CPACK_PACKAGE_DESCRIPTION", ostr.str());
     cmValue defFileName =
       this->GetOption("CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE");
@@ -166,6 +175,8 @@ int cmCPackGenerator::PrepareNames()
         << std::endl);
     return 0;
   }
+
+  // Check algorithm for calculating the checksum of the package.
   cmValue algoSignature = this->GetOption("CPACK_PACKAGE_CHECKSUM");
   if (algoSignature) {
     if (!cmCryptoHash::New(*algoSignature)) {
@@ -176,8 +187,6 @@ int cmCPackGenerator::PrepareNames()
     }
   }
 
-  this->SetOptionIfNotSet("CPACK_REMOVE_TOPLEVEL_DIRECTORY", "1");
-
   return 1;
 }
 
@@ -188,20 +197,20 @@ int cmCPackGenerator::InstallProject()
 
   std::string bareTempInstallDirectory =
     this->GetOption("CPACK_TEMPORARY_DIRECTORY");
-  std::string tempInstallDirectoryStr = bareTempInstallDirectory;
+  std::string tempInstallDirectory = bareTempInstallDirectory;
   bool setDestDir = this->GetOption("CPACK_SET_DESTDIR").IsOn() ||
     cmIsInternallyOn(this->GetOption("CPACK_SET_DESTDIR"));
   if (!setDestDir) {
-    tempInstallDirectoryStr += this->GetPackagingInstallPrefix();
+    tempInstallDirectory += this->GetPackagingInstallPrefix();
   }
 
-  const char* tempInstallDirectory = tempInstallDirectoryStr.c_str();
   int res = 1;
   if (!cmsys::SystemTools::MakeDirectory(bareTempInstallDirectory)) {
-    cmCPackLogger(cmCPackLog::LOG_ERROR,
-                  "Problem creating temporary directory: "
-                    << (tempInstallDirectory ? tempInstallDirectory : "(NULL)")
-                    << std::endl);
+    cmCPackLogger(
+      cmCPackLog::LOG_ERROR,
+      "Problem creating temporary directory: "
+        << (!tempInstallDirectory.empty() ? tempInstallDirectory : "(NULL)")
+        << std::endl);
     return 0;
   }
 
@@ -881,7 +890,7 @@ int cmCPackGenerator::InstallCMakeProject(
   if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) {
     mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
   }
-  // If current CPack generator does support
+  // If current CPack generator does not support
   // ABSOLUTE INSTALL DESTINATION or CPack has been asked for
   // then ask cmake_install.cmake script to error out
   // as soon as it occurs (before installing file)
@@ -974,6 +983,48 @@ int cmCPackGenerator::InstallCMakeProject(
   return 1;
 }
 
+bool cmCPackGenerator::GenerateChecksumFile(cmCryptoHash& crypto,
+                                            cm::string_view filename) const
+{
+  std::string packageFileName =
+    cmStrCat(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"), "/", filename);
+  std::string hashFile = cmStrCat(
+    packageFileName, "." + cmSystemTools::LowerCase(crypto.GetHashAlgoName()));
+  cmsys::ofstream outF(hashFile.c_str());
+  if (!outF) {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+                  "Cannot create checksum file: " << hashFile << std::endl);
+    return false;
+  }
+  outF << crypto.HashFile(packageFileName) << "  " << filename << "\n";
+  cmCPackLogger(cmCPackLog::LOG_OUTPUT,
+                "- checksum file: " << hashFile << " generated." << std::endl);
+  return true;
+}
+
+bool cmCPackGenerator::CopyPackageFile(const std::string& srcFilePath,
+                                       cm::string_view filename) const
+{
+  std::string destFilePath =
+    cmStrCat(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"), "/", filename);
+  cmCPackLogger(cmCPackLog::LOG_DEBUG,
+                "Copy final package(s): "
+                  << (!srcFilePath.empty() ? srcFilePath : "(NULL)") << " to "
+                  << (!destFilePath.empty() ? destFilePath : "(NULL)")
+                  << std::endl);
+  if (!cmSystemTools::CopyFileIfDifferent(srcFilePath, destFilePath)) {
+    cmCPackLogger(
+      cmCPackLog::LOG_ERROR,
+      "Problem copying the package: "
+        << (!srcFilePath.empty() ? srcFilePath : "(NULL)") << " to "
+        << (!destFilePath.empty() ? destFilePath : "(NULL)") << std::endl);
+    return false;
+  }
+  cmCPackLogger(cmCPackLog::LOG_OUTPUT,
+                "- package: " << destFilePath << " generated." << std::endl);
+  return true;
+}
+
 bool cmCPackGenerator::ReadListFile(const char* moduleName)
 {
   bool retval;
@@ -1043,6 +1094,7 @@ int cmCPackGenerator::DoPackage()
     return 0;
   }
 
+  // Possibly remove the top-level packaging-directory.
   if (this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY").IsOn()) {
     cmValue toplevelDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
     if (toplevelDirectory && cmSystemTools::FileExists(*toplevelDirectory)) {
@@ -1057,55 +1109,68 @@ int cmCPackGenerator::DoPackage()
       }
     }
   }
+
+  // Install the project (to the temporary install-directory).
   cmCPackLogger(cmCPackLog::LOG_DEBUG,
                 "About to install project " << std::endl);
-
   if (!this->InstallProject()) {
     return 0;
   }
   cmCPackLogger(cmCPackLog::LOG_DEBUG, "Done install project " << std::endl);
 
-  cmValue tempPackageFileName =
-    this->GetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME");
+  // Determine the temporary directory whose content shall be packaged.
   cmValue tempDirectory = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
 
+  // Determine and store internally the list of files to be installed.
   cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
-  cmsys::Glob gl;
-  std::string findExpr = cmStrCat(tempDirectory, "/*");
-  gl.RecurseOn();
-  gl.SetRecurseListDirs(true);
-  gl.SetRecurseThroughSymlinks(false);
-  if (!gl.FindFiles(findExpr)) {
-    cmCPackLogger(cmCPackLog::LOG_ERROR,
-                  "Cannot find any files in the packaging tree" << std::endl);
-    return 0;
+  {
+    cmsys::Glob gl;
+    std::string findExpr = cmStrCat(tempDirectory, "/*");
+    gl.RecurseOn();
+    gl.SetRecurseListDirs(true);
+    gl.SetRecurseThroughSymlinks(false);
+    if (!gl.FindFiles(findExpr)) {
+      cmCPackLogger(cmCPackLog::LOG_ERROR,
+                    "Cannot find any files in the packaging tree"
+                      << std::endl);
+      return 0;
+    }
+    this->files = gl.GetFiles();
   }
 
-  cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Create package" << std::endl);
-  cmCPackLogger(cmCPackLog::LOG_VERBOSE,
-                "Package files to: "
-                  << (tempPackageFileName ? *tempPackageFileName : "(NULL)")
-                  << std::endl);
-  if (tempPackageFileName && cmSystemTools::FileExists(*tempPackageFileName)) {
-    cmCPackLogger(cmCPackLog::LOG_VERBOSE,
-                  "Remove old package file" << std::endl);
-    cmSystemTools::RemoveFile(*tempPackageFileName);
-  }
+  // Determine and store internally the directory that shall be packaged.
   if (this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY").IsOn()) {
     tempDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
   }
+  this->toplevel = *tempDirectory;
 
-  // The files to be installed
-  this->files = gl.GetFiles();
+  cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Create package" << std::endl);
 
-  this->packageFileNames.clear();
-  /* Put at least one file name into the list of
-   * wanted packageFileNames. The specific generator
-   * may update this during PackageFiles.
-   * (either putting several names or updating the provided one)
-   */
-  this->packageFileNames.emplace_back(tempPackageFileName);
-  this->toplevel = *tempDirectory;
+  // Determine and store internally the list of packages to create.
+  // Note: Initially, this only contains a single package.
+  {
+    cmValue tempPackageFileName =
+      this->GetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME");
+    cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+                  "Package files to: "
+                    << (tempPackageFileName ? *tempPackageFileName : "(NULL)")
+                    << std::endl);
+    if (tempPackageFileName &&
+        cmSystemTools::FileExists(*tempPackageFileName)) {
+      cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+                    "Remove old package file" << std::endl);
+      cmSystemTools::RemoveFile(*tempPackageFileName);
+    }
+    this->packageFileNames.clear();
+    /* Put at least one file name into the list of
+     * wanted packageFileNames. The specific generator
+     * may update this during PackageFiles.
+     * (either putting several names or updating the provided one)
+     */
+    this->packageFileNames.emplace_back(tempPackageFileName);
+  }
+
+  // Do package the files (using the derived CPack generators.
   { // scope that enables package generators to run internal scripts with
     // latest CMake policies enabled
     cmMakefile::ScopePushPop pp{ this->MakefileMap };
@@ -1118,6 +1183,7 @@ int cmCPackGenerator::DoPackage()
       return 0;
     }
   }
+
   // Run post-build actions
   cmValue postBuildScripts = this->GetOption("CPACK_POST_BUILD_SCRIPTS");
   if (postBuildScripts) {
@@ -1153,44 +1219,15 @@ int cmCPackGenerator::DoPackage()
                                              << "]:" << std::endl);
   /* now copy package one by one */
   for (std::string const& pkgFileName : this->packageFileNames) {
-    std::string tmpPF(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
     std::string filename(cmSystemTools::GetFilenameName(pkgFileName));
-    tempPackageFileName = cmValue(pkgFileName);
-    tmpPF += "/" + filename;
-    const char* packageFileName = tmpPF.c_str();
-    cmCPackLogger(cmCPackLog::LOG_DEBUG,
-                  "Copy final package(s): "
-                    << (tempPackageFileName ? *tempPackageFileName : "(NULL)")
-                    << " to " << (packageFileName ? packageFileName : "(NULL)")
-                    << std::endl);
-    if (!cmSystemTools::CopyFileIfDifferent(pkgFileName, tmpPF)) {
-      cmCPackLogger(
-        cmCPackLog::LOG_ERROR,
-        "Problem copying the package: "
-          << (tempPackageFileName ? *tempPackageFileName : "(NULL)") << " to "
-          << (packageFileName ? packageFileName : "(NULL)") << std::endl);
+    if (!this->CopyPackageFile(pkgFileName, filename)) {
       return 0;
     }
-    cmCPackLogger(cmCPackLog::LOG_OUTPUT,
-                  "- package: " << packageFileName << " generated."
-                                << std::endl);
-
     /* Generate checksum file */
     if (crypto) {
-      std::string hashFile(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
-      hashFile += "/" + filename;
-      hashFile += "." + cmSystemTools::LowerCase(algo);
-      cmsys::ofstream outF(hashFile.c_str());
-      if (!outF) {
-        cmCPackLogger(cmCPackLog::LOG_ERROR,
-                      "Cannot create checksum file: " << hashFile
-                                                      << std::endl);
+      if (!this->GenerateChecksumFile(*crypto, filename)) {
         return 0;
       }
-      outF << crypto->HashFile(packageFileName) << "  " << filename << "\n";
-      cmCPackLogger(cmCPackLog::LOG_OUTPUT,
-                    "- checksum file: " << hashFile << " generated."
-                                        << std::endl);
     }
   }
 
@@ -1495,8 +1532,8 @@ int cmCPackGenerator::PrepareGroupingKind()
     this->componentPackageMethod = method;
   }
 
-  const char* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE_GROUPS",
-                                 "ONE_PER_GROUP" };
+  const char* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE",
+                                 "ONE_PER_GROUP", "UNKNOWN" };
 
   cmCPackLogger(cmCPackLog::LOG_VERBOSE,
                 "[" << this->Name << "]"

+ 6 - 0
Source/CPack/cmCPackGenerator.h

@@ -19,6 +19,7 @@
 #include "cmValue.h"
 
 class cmCPackLog;
+class cmCryptoHash;
 class cmGlobalGenerator;
 class cmInstalledFile;
 class cmMakefile;
@@ -182,6 +183,11 @@ protected:
   virtual const char* GetInstallPath();
   virtual const char* GetPackagingInstallPrefix();
 
+  bool GenerateChecksumFile(cmCryptoHash& crypto,
+                            cm::string_view filename) const;
+  bool CopyPackageFile(const std::string& srcFilePath,
+                       cm::string_view filename) const;
+
   std::string FindTemplate(cm::string_view name,
                            cm::optional<cm::string_view> alt = cm::nullopt);
   virtual bool ConfigureFile(const std::string& inName,

+ 33 - 0
Source/cmCryptoHash.cxx

@@ -2,6 +2,8 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmCryptoHash.h"
 
+#include <cassert>
+
 #include <cm/memory>
 
 #include <cm3p/kwiml/int.h>
@@ -80,6 +82,37 @@ std::unique_ptr<cmCryptoHash> cmCryptoHash::New(cm::string_view algo)
   return std::unique_ptr<cmCryptoHash>(nullptr);
 }
 
+std::string cmCryptoHash::GetHashAlgoName() const
+{
+#ifndef CMAKE_USE_SYSTEM_LIBRHASH
+  static_assert(RHASH_HASH_COUNT == 10, "Update switch statement!");
+#endif
+  switch (this->Id) {
+    case RHASH_MD5:
+      return "MD5";
+    case RHASH_SHA1:
+      return "SHA1";
+    case RHASH_SHA224:
+      return "SHA224";
+    case RHASH_SHA256:
+      return "SHA256";
+    case RHASH_SHA384:
+      return "SHA384";
+    case RHASH_SHA512:
+      return "SHA512";
+    case RHASH_SHA3_224:
+      return "SHA3_224";
+    case RHASH_SHA3_256:
+      return "SHA3_256";
+    case RHASH_SHA3_384:
+      return "SHA3_384";
+    case RHASH_SHA3_512:
+      return "SHA3_512";
+  }
+  assert(false);
+  return "UNKNOWN";
+}
+
 bool cmCryptoHash::IntFromHexDigit(char input, char& output)
 {
   if (input >= '0' && input <= '9') {

+ 4 - 0
Source/cmCryptoHash.h

@@ -74,6 +74,10 @@ public:
   ///         An empty string otherwise.
   std::string HashFile(const std::string& file);
 
+  /// @brief Returns the name of the hash type.
+  /// @return The name of the hash type associated with this hash generator.
+  std::string GetHashAlgoName() const;
+
   void Initialize();
   void Append(void const*, size_t);
   void Append(cm::string_view input);

+ 4 - 4
Source/cmLocalGenerator.cxx

@@ -595,7 +595,7 @@ void cmLocalGenerator::GenerateInstallRules()
         "CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM")) {
     /* clang-format off */
     fout <<
-      "# Set default install directory permissions.\n"
+      "# Set OS and executable format for runtime-dependencies.\n"
       "if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM)\n"
       "  set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM \""
          << *platform << "\")\n"
@@ -611,7 +611,7 @@ void cmLocalGenerator::GenerateInstallRules()
         this->Makefile->GetDefinition("CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL")) {
     /* clang-format off */
     fout <<
-      "# Set default install directory permissions.\n"
+      "# Set tool for dependency-resolution of runtime-dependencies.\n"
       "if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL)\n"
       "  set(CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL \""
          << *command << "\")\n"
@@ -627,7 +627,7 @@ void cmLocalGenerator::GenerateInstallRules()
         "CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND")) {
     /* clang-format off */
     fout <<
-      "# Set default install directory permissions.\n"
+      "# Set path to tool for dependency-resolution of runtime-dependencies.\n"
       "if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND)\n"
       "  set(CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND \""
          << *command << "\")\n"
@@ -644,7 +644,7 @@ void cmLocalGenerator::GenerateInstallRules()
   if (cmValue command = this->Makefile->GetDefinition("CMAKE_OBJDUMP")) {
     /* clang-format off */
     fout <<
-      "# Set default install directory permissions.\n"
+      "# Set path to fallback-tool for dependency-resolution.\n"
       "if(NOT DEFINED CMAKE_OBJDUMP)\n"
       "  set(CMAKE_OBJDUMP \""
          << *command << "\")\n"