[Cmake-commits] CMake branch, next, updated. v3.6.1-1198-g0ed4b78

Brad King brad.king at kitware.com
Tue Aug 9 10:10:22 EDT 2016


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, next has been updated
       via  0ed4b78da380e9c0f2ed5c2489863bfe47124c09 (commit)
       via  c7a319ab057172071bf8fb909c4498ca87b1235a (commit)
      from  1554a1b92f5fbdde852bc08e5e3534e42a914691 (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=0ed4b78da380e9c0f2ed5c2489863bfe47124c09
commit 0ed4b78da380e9c0f2ed5c2489863bfe47124c09
Merge: 1554a1b c7a319a
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Aug 9 10:10:21 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Aug 9 10:10:21 2016 -0400

    Merge topic 'install-export-staging-dir' into next
    
    c7a319ab install(EXPORT): Fix support for mid-length install destinations on Windows


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c7a319ab057172071bf8fb909c4498ca87b1235a
commit c7a319ab057172071bf8fb909c4498ca87b1235a
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Aug 9 09:53:16 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Aug 9 10:09:52 2016 -0400

    install(EXPORT): Fix support for mid-length install destinations on Windows
    
    The implementation of `install(EXPORT)` generates files into a staging
    directory for later installation.  We use the full install destination
    in the path to the staging directory to avoid collisions.  In order to
    avoid exceeding maximum path lengths (especially on Windows) we compute
    a hash of the install destination when it is too long.  Fix this logic
    to account for the length of the file name(s) when deciding whether to
    switch to the hashed name.
    
    Reported-by: Alan W. Irwin <irwin at beluga.phys.uvic.ca>

diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 6250012..0fcd8ba 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -74,9 +74,12 @@ void cmInstallExportGenerator::ComputeTempDir()
 #else
   std::string::size_type const max_total_len = 1000;
 #endif
-  if (this->TempDir.size() < max_total_len) {
+  // Will generate files of the form "<temp-dir>/<base>-<config>.<ext>".
+  std::string::size_type const len = this->TempDir.size() + 1 +
+    this->FileName.size() + 1 + this->GetMaxConfigLength();
+  if (len < max_total_len) {
     // Keep the total path length below the limit.
-    std::string::size_type max_len = max_total_len - this->TempDir.size();
+    std::string::size_type const max_len = max_total_len - len;
     if (this->Destination.size() > max_len) {
       useMD5 = true;
     }
@@ -102,6 +105,26 @@ void cmInstallExportGenerator::ComputeTempDir()
   }
 }
 
+size_t cmInstallExportGenerator::GetMaxConfigLength() const
+{
+  // Always use at least 8 for "noconfig".
+  size_t len = 8;
+  if (this->ConfigurationTypes->empty()) {
+    if (this->ConfigurationName.size() > 8) {
+      len = this->ConfigurationName.size();
+    }
+  } else {
+    for (std::vector<std::string>::const_iterator ci =
+           this->ConfigurationTypes->begin();
+         ci != this->ConfigurationTypes->end(); ++ci) {
+      if (ci->size() > len) {
+        len = ci->size();
+      }
+    }
+  }
+  return len;
+}
+
 void cmInstallExportGenerator::GenerateScript(std::ostream& os)
 {
   // Skip empty sets.
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 4435f53..22e661b 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -53,6 +53,7 @@ protected:
   void GenerateImportFile(cmExportSet const* exportSet);
   void GenerateImportFile(const char* config, cmExportSet const* exportSet);
   void ComputeTempDir();
+  size_t GetMaxConfigLength() const;
 
   cmExportSet* ExportSet;
   std::string FilePermissions;

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

Summary of changes:
 Source/cmInstallExportGenerator.cxx |   27 +++++++++++++++++++++++++--
 Source/cmInstallExportGenerator.h   |    1 +
 2 files changed, 26 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list