diff options
author | Brad King <brad.king@kitware.com> | 2016-08-10 15:15:50 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-08-10 15:15:50 (GMT) |
commit | f4cec30b5326804b7c82c09dad85e78ce8fa3b32 (patch) | |
tree | a0ce6ccdfcd27f6b993f3f0666d5e6c9b65cf5a3 /Source | |
parent | 4887640b7a69ee1febc19c50add55f8e07bb42b8 (diff) | |
parent | c7a319ab057172071bf8fb909c4498ca87b1235a (diff) | |
download | CMake-f4cec30b5326804b7c82c09dad85e78ce8fa3b32.zip CMake-f4cec30b5326804b7c82c09dad85e78ce8fa3b32.tar.gz CMake-f4cec30b5326804b7c82c09dad85e78ce8fa3b32.tar.bz2 |
Merge topic 'install-export-staging-dir'
c7a319ab install(EXPORT): Fix support for mid-length install destinations on Windows
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmInstallExportGenerator.cxx | 27 | ||||
-rw-r--r-- | Source/cmInstallExportGenerator.h | 1 |
2 files changed, 26 insertions, 2 deletions
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; |