diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2020-03-31 01:44:29 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2020-04-03 11:35:35 (GMT) |
commit | b3bacf0152c15d46b5392c622b46dbfa2ad8c6c2 (patch) | |
tree | 0f8f14a5d516eb3baa7e11c5247fa23293420225 /Source/CPack | |
parent | b71d385ed466363c64af82fb0bffd5f4fdc4b1c3 (diff) | |
download | CMake-b3bacf0152c15d46b5392c622b46dbfa2ad8c6c2.zip CMake-b3bacf0152c15d46b5392c622b46dbfa2ad8c6c2.tar.gz CMake-b3bacf0152c15d46b5392c622b46dbfa2ad8c6c2.tar.bz2 |
cmCPackArchiveGenerator: support multithreaded compression
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/cmCPackArchiveGenerator.cxx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index d5654da..aaa5318 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -8,6 +8,8 @@ #include <utility> #include <vector> +#include "cm_libarchive.h" + #include "cmCPackComponentGroup.h" #include "cmCPackGenerator.h" #include "cmCPackLog.h" @@ -343,7 +345,22 @@ bool cmCPackArchiveGenerator::SupportsComponentInstallation() const return IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL"); } -bool cmCPackArchiveGenerator::SetArchiveOptions(cmArchiveWrite* /*archive*/) +bool cmCPackArchiveGenerator::SetArchiveOptions(cmArchiveWrite* archive) { +#if ARCHIVE_VERSION_NUMBER >= 3004000 + // Upstream fixed an issue with their integer parsing in 3.4.0 which would + // cause spurious errors to be raised from `strtoull`. + if (this->Compress == cmArchiveWrite::CompressXZ) { + const char* threads = "1"; + if (this->IsSet("CPACK_ARCHIVE_THREADS")) { + threads = this->GetOption("CPACK_ARCHIVE_THREADS"); + } + + if (!archive->SetFilterOption("xz", "threads", threads)) { + return false; + } + } +#endif + return true; } |