diff options
-rw-r--r-- | Source/CPack/cmCPackZIPGenerator.cxx | 26 | ||||
-rw-r--r-- | Source/CPack/cmCPackZIPGenerator.h | 3 |
2 files changed, 28 insertions, 1 deletions
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: |