diff options
author | Andrey Filipenkov <decapitator@ukr.net> | 2022-08-11 12:35:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-09-01 15:35:58 (GMT) |
commit | cc3cd8bc2a7510db9eaee5a160c80e338273af57 (patch) | |
tree | d0ce2d88077a5e3e44c325f2d932450c400887a5 /Source/CPack/cmCPackArchiveGenerator.cxx | |
parent | 5d0685aa3ee20be4553eacfdc144d63e6ad2fcd5 (diff) | |
download | CMake-cc3cd8bc2a7510db9eaee5a160c80e338273af57.zip CMake-cc3cd8bc2a7510db9eaee5a160c80e338273af57.tar.gz CMake-cc3cd8bc2a7510db9eaee5a160c80e338273af57.tar.bz2 |
CPack: allow custom file extension in archive generator
Diffstat (limited to 'Source/CPack/cmCPackArchiveGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackArchiveGenerator.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 56e8463..894c24b 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -94,6 +94,18 @@ std::string cmCPackArchiveGenerator::GetArchiveComponentFileName( int cmCPackArchiveGenerator::InitializeInternal() { this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1"); + cmValue newExtensionValue = this->GetOption("CPACK_ARCHIVE_FILE_EXTENSION"); + if (!newExtensionValue.IsEmpty()) { + std::string newExtension = *newExtensionValue; + if (!cmHasLiteralPrefix(newExtension, ".")) { + newExtension = cmStrCat('.', newExtension); + } + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Using user-provided file extension " + << newExtension << " instead of the default " + << this->OutputExtension << std::endl); + this->OutputExtension = std::move(newExtension); + } return this->Superclass::InitializeInternal(); } |