diff options
Diffstat (limited to 'Source')
-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; } |