From f80d98bc09982540f874925da3c324537f2ac201 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Thu, 14 Jun 2007 12:03:53 -0400 Subject: ENH: support 7zip for creating zip files (not 7z files) Alex --- Source/CPack/cmCPackZIPGenerator.cxx | 26 ++++++++++++++++++++++++++ Source/CPack/cmCPackZIPGenerator.h | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index 962cc75..f14622f 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -56,6 +56,25 @@ int cmCPackZIPGenerator::InitializeInternal() this->ZipStyle = cmCPackZIPGenerator::StyleWinZip; found = true; } + + if ( !found ) + { + pkgPath = "c:/Program Files/7-Zip"; + path.push_back(pkgPath); + pkgPath = cmSystemTools::FindProgram("7z", path, false); + + if ( pkgPath.empty() ) + { + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Cannot find 7ZIP" + << std::endl); + } + else + { + this->ZipStyle = cmCPackZIPGenerator::Style7Zip; + found = true; + } + } + if ( !found ) { path.erase(path.begin(), path.end()); @@ -103,6 +122,13 @@ int cmCPackZIPGenerator::CompressFiles(const char* outFileName, << "\" @winZip.filelist"; needQuotesInFile = true; break; + case cmCPackZIPGenerator::Style7Zip: + // this is the zip generator, so tell 7zip to generate zip files + dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM") + << "\" a -tzip \"" << outFileName + << "\" @winZip.filelist"; + needQuotesInFile = true; + break; case cmCPackZIPGenerator::StyleUnixZip: dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM") << "\" -r \"" << outFileName diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h index 8700360..06d9b99 100644 --- a/Source/CPack/cmCPackZIPGenerator.h +++ b/Source/CPack/cmCPackZIPGenerator.h @@ -41,7 +41,8 @@ public: { StyleUnkown, StyleWinZip, - StyleUnixZip + StyleUnixZip, + Style7Zip }; protected: -- cgit v0.12