summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-09-07 13:44:07 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-09-07 13:44:16 (GMT)
commit69947f4984e4d79529a09e7f3a641d83ef7d99e4 (patch)
tree0628686d88468b1c0995718c637b2ed73412efc4 /Source/CPack
parent0dc1e0a20c157c1b5df7ab3973fc4dba90cf6531 (diff)
parentcc3cd8bc2a7510db9eaee5a160c80e338273af57 (diff)
downloadCMake-69947f4984e4d79529a09e7f3a641d83ef7d99e4.zip
CMake-69947f4984e4d79529a09e7f3a641d83ef7d99e4.tar.gz
CMake-69947f4984e4d79529a09e7f3a641d83ef7d99e4.tar.bz2
Merge topic 'cpack-archive-custom-extension'
cc3cd8bc2a CPack: allow custom file extension in archive generator Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7563
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx12
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();
}