ENH: support 7zip for creating zip files (not 7z files)

Alex
This commit is contained in:
Alexander Neundorf 2007-06-14 12:03:53 -04:00
parent 756f455565
commit f80d98bc09
2 changed files with 28 additions and 1 deletions

View File

@ -56,6 +56,25 @@ int cmCPackZIPGenerator::InitializeInternal()
this->ZipStyle = cmCPackZIPGenerator::StyleWinZip; this->ZipStyle = cmCPackZIPGenerator::StyleWinZip;
found = true; 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 ) if ( !found )
{ {
path.erase(path.begin(), path.end()); path.erase(path.begin(), path.end());
@ -103,6 +122,13 @@ int cmCPackZIPGenerator::CompressFiles(const char* outFileName,
<< "\" @winZip.filelist"; << "\" @winZip.filelist";
needQuotesInFile = true; needQuotesInFile = true;
break; 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: case cmCPackZIPGenerator::StyleUnixZip:
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM") dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
<< "\" -r \"" << outFileName << "\" -r \"" << outFileName

View File

@ -41,7 +41,8 @@ public:
{ {
StyleUnkown, StyleUnkown,
StyleWinZip, StyleWinZip,
StyleUnixZip StyleUnixZip,
Style7Zip
}; };
protected: protected: