ENH: add ReadListFile() to cmCPackGenericGenerator, so cmMakefile can be
private again -convert the ZIP generator to use a cmake script instead of hardcoding everything (CPackZIP.cmake) Alex
This commit is contained in:
parent
4ae802d9c1
commit
919265516e
|
@ -0,0 +1,27 @@
|
||||||
|
IF(CMAKE_BINARY_DIR)
|
||||||
|
MESSAGE(FATAL_ERROR "CPackZIP.cmake may only be used by CPack internally.")
|
||||||
|
ENDIF(CMAKE_BINARY_DIR)
|
||||||
|
|
||||||
|
FIND_PROGRAM(ZIP_EXECUTABLE wzzip PATHS "$ENV{ProgramFiles}/WinZip")
|
||||||
|
IF(ZIP_EXECUTABLE)
|
||||||
|
SET(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -P \"<ARCHIVE>\" @<FILELIST>")
|
||||||
|
SET(CPACK_ZIP_NEED_QUOTES TRUE)
|
||||||
|
ENDIF(ZIP_EXECUTABLE)
|
||||||
|
|
||||||
|
IF(NOT ZIP_EXECUTABLE)
|
||||||
|
FIND_PROGRAM(ZIP_EXECUTABLE 7z PATHS "$ENV{ProgramFiles}/7-Zip")
|
||||||
|
IF(ZIP_EXECUTABLE)
|
||||||
|
SET(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" a -tzip \"<ARCHIVE>\" @<FILELIST>")
|
||||||
|
SET(CPACK_ZIP_NEED_QUOTES TRUE)
|
||||||
|
ENDIF(ZIP_EXECUTABLE)
|
||||||
|
ENDIF(NOT ZIP_EXECUTABLE)
|
||||||
|
|
||||||
|
IF(NOT ZIP_EXECUTABLE)
|
||||||
|
FIND_PACKAGE(Cygwin)
|
||||||
|
FIND_PROGRAM(ZIP_EXECUTABLE zip PATHS "${CYGWIN_INSTALL_PATH}/bin")
|
||||||
|
IF(ZIP_EXECUTABLE)
|
||||||
|
SET(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -r \"<ARCHIVE>\" . -i@<FILELIST>")
|
||||||
|
SET(CPACK_ZIP_NEED_QUOTES FALSE)
|
||||||
|
ENDIF(ZIP_EXECUTABLE)
|
||||||
|
ENDIF(NOT ZIP_EXECUTABLE)
|
||||||
|
|
|
@ -30,3 +30,8 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
SET(CMAKE_CXX_LINK_EXECUTABLE
|
SET(CMAKE_CXX_LINK_EXECUTABLE
|
||||||
"<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lstdc++,-lgcc,-lc -lnss_files -lnss_dns -lresolv")
|
"<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lstdc++,-lgcc,-lc -lnss_files -lnss_dns -lresolv")
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
|
||||||
|
SET(CMAKE_CXX_LINK_SHARED_LIBRARY)
|
||||||
|
SET(CMAKE_CXX_LINK_MODULE_LIBRARY)
|
||||||
|
SET(CMAKE_C_LINK_SHARED_LIBRARY)
|
||||||
|
SET(CMAKE_C_LINK_MODULE_LIBRARY)
|
||||||
|
|
|
@ -32,14 +32,14 @@
|
||||||
cmCPackGenericGenerator::cmCPackGenericGenerator()
|
cmCPackGenericGenerator::cmCPackGenericGenerator()
|
||||||
{
|
{
|
||||||
this->GeneratorVerbose = false;
|
this->GeneratorVerbose = false;
|
||||||
this->Makefile = 0;
|
this->MakefileMap = 0;
|
||||||
this->Logger = 0;
|
this->Logger = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
cmCPackGenericGenerator::~cmCPackGenericGenerator()
|
cmCPackGenericGenerator::~cmCPackGenericGenerator()
|
||||||
{
|
{
|
||||||
this->Makefile = 0;
|
this->MakefileMap = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -392,7 +392,7 @@ int cmCPackGenericGenerator::InstallProjectViaInstallScript(
|
||||||
tempInstallDirectory);
|
tempInstallDirectory);
|
||||||
this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR",
|
this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR",
|
||||||
tempInstallDirectory);
|
tempInstallDirectory);
|
||||||
int res = this->Makefile->ReadListFile(0, installScript.c_str());
|
int res = this->MakefileMap->ReadListFile(0, installScript.c_str());
|
||||||
if ( cmSystemTools::GetErrorOccuredFlag() || !res )
|
if ( cmSystemTools::GetErrorOccuredFlag() || !res )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -454,7 +454,7 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(
|
||||||
|
|
||||||
const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG");
|
const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG");
|
||||||
cmGlobalGenerator* globalGenerator
|
cmGlobalGenerator* globalGenerator
|
||||||
= this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
|
= this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator(
|
||||||
cmakeGenerator);
|
cmakeGenerator);
|
||||||
// set the global flag for unix style paths on cmSystemTools as
|
// set the global flag for unix style paths on cmSystemTools as
|
||||||
// soon as the generator is set. This allows gmake to be used
|
// soon as the generator is set. This allows gmake to be used
|
||||||
|
@ -464,9 +464,9 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(
|
||||||
// Does this generator require pre-install?
|
// Does this generator require pre-install?
|
||||||
if ( globalGenerator->GetPreinstallTargetName() )
|
if ( globalGenerator->GetPreinstallTargetName() )
|
||||||
{
|
{
|
||||||
globalGenerator->FindMakeProgram(this->Makefile);
|
globalGenerator->FindMakeProgram(this->MakefileMap);
|
||||||
const char* cmakeMakeProgram
|
const char* cmakeMakeProgram
|
||||||
= this->Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
|
= this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM");
|
||||||
std::string buildCommand
|
std::string buildCommand
|
||||||
= globalGenerator->GenerateBuildCommand(cmakeMakeProgram,
|
= globalGenerator->GenerateBuildCommand(cmakeMakeProgram,
|
||||||
installProjectName.c_str(), 0,
|
installProjectName.c_str(), 0,
|
||||||
|
@ -550,11 +550,18 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool cmCPackGenericGenerator::ReadListFile(const char* moduleName)
|
||||||
|
{
|
||||||
|
std::string fullPath = this->MakefileMap->GetModulesFile(moduleName);
|
||||||
|
return this->MakefileMap->ReadListFile(0, fullPath.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void cmCPackGenericGenerator::SetOptionIfNotSet(const char* op,
|
void cmCPackGenericGenerator::SetOptionIfNotSet(const char* op,
|
||||||
const char* value)
|
const char* value)
|
||||||
{
|
{
|
||||||
const char* def = this->Makefile->GetDefinition(op);
|
const char* def = this->MakefileMap->GetDefinition(op);
|
||||||
if ( def && *def )
|
if ( def && *def )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -571,12 +578,12 @@ void cmCPackGenericGenerator::SetOption(const char* op, const char* value)
|
||||||
}
|
}
|
||||||
if ( !value )
|
if ( !value )
|
||||||
{
|
{
|
||||||
this->Makefile->RemoveDefinition(op);
|
this->MakefileMap->RemoveDefinition(op);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, this->GetNameOfClass()
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, this->GetNameOfClass()
|
||||||
<< "::SetOption(" << op << ", " << value << ")" << std::endl);
|
<< "::SetOption(" << op << ", " << value << ")" << std::endl);
|
||||||
this->Makefile->AddDefinition(op, value);
|
this->MakefileMap->AddDefinition(op, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -680,7 +687,7 @@ int cmCPackGenericGenerator::ProcessGenerator()
|
||||||
int cmCPackGenericGenerator::Initialize(const char* name, cmMakefile* mf,
|
int cmCPackGenericGenerator::Initialize(const char* name, cmMakefile* mf,
|
||||||
const char* argv0)
|
const char* argv0)
|
||||||
{
|
{
|
||||||
this->Makefile = mf;
|
this->MakefileMap = mf;
|
||||||
this->Name = name;
|
this->Name = name;
|
||||||
if ( !this->FindRunningCMake(argv0) )
|
if ( !this->FindRunningCMake(argv0) )
|
||||||
{
|
{
|
||||||
|
@ -697,10 +704,16 @@ int cmCPackGenericGenerator::InitializeInternal()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool cmCPackGenericGenerator::IsSet(const char* name) const
|
||||||
|
{
|
||||||
|
return this->MakefileMap->IsSet(name);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const char* cmCPackGenericGenerator::GetOption(const char* op)
|
const char* cmCPackGenericGenerator::GetOption(const char* op)
|
||||||
{
|
{
|
||||||
return this->Makefile->GetDefinition(op);
|
return this->MakefileMap->GetDefinition(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -913,7 +926,7 @@ std::string cmCPackGenericGenerator::FindTemplate(const char* name)
|
||||||
{
|
{
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Look for template: "
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Look for template: "
|
||||||
<< (name ? name : "(NULL)") << std::endl);
|
<< (name ? name : "(NULL)") << std::endl);
|
||||||
std::string ffile = this->Makefile->GetModulesFile(name);
|
std::string ffile = this->MakefileMap->GetModulesFile(name);
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Found template: "
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Found template: "
|
||||||
<< ffile.c_str() << std::endl);
|
<< ffile.c_str() << std::endl);
|
||||||
return ffile;
|
return ffile;
|
||||||
|
@ -923,7 +936,7 @@ std::string cmCPackGenericGenerator::FindTemplate(const char* name)
|
||||||
bool cmCPackGenericGenerator::ConfigureString(const std::string& inString,
|
bool cmCPackGenericGenerator::ConfigureString(const std::string& inString,
|
||||||
std::string& outString)
|
std::string& outString)
|
||||||
{
|
{
|
||||||
this->Makefile->ConfigureString(inString,
|
this->MakefileMap->ConfigureString(inString,
|
||||||
outString, true, false);
|
outString, true, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -932,7 +945,7 @@ bool cmCPackGenericGenerator::ConfigureString(const std::string& inString,
|
||||||
bool cmCPackGenericGenerator::ConfigureFile(const char* inName,
|
bool cmCPackGenericGenerator::ConfigureFile(const char* inName,
|
||||||
const char* outName, bool copyOnly /* = false */)
|
const char* outName, bool copyOnly /* = false */)
|
||||||
{
|
{
|
||||||
return this->Makefile->ConfigureFile(inName, outName,
|
return this->MakefileMap->ConfigureFile(inName, outName,
|
||||||
copyOnly, true, false) == 1;
|
copyOnly, true, false) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ public:
|
||||||
void SetOption(const char* op, const char* value);
|
void SetOption(const char* op, const char* value);
|
||||||
void SetOptionIfNotSet(const char* op, const char* value);
|
void SetOptionIfNotSet(const char* op, const char* value);
|
||||||
const char* GetOption(const char* op);
|
const char* GetOption(const char* op);
|
||||||
|
bool IsSet(const char* name) const;
|
||||||
|
|
||||||
//! Set all the variables
|
//! Set all the variables
|
||||||
int FindRunningCMake(const char* arg0);
|
int FindRunningCMake(const char* arg0);
|
||||||
|
@ -89,6 +90,8 @@ public:
|
||||||
|
|
||||||
//! Display verbose information via logger
|
//! Display verbose information via logger
|
||||||
void DisplayVerboseOutput(const char* msg, float progress);
|
void DisplayVerboseOutput(const char* msg, float progress);
|
||||||
|
|
||||||
|
bool ReadListFile(const char* moduleName);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int PrepareNames();
|
int PrepareNames();
|
||||||
|
@ -129,8 +132,8 @@ protected:
|
||||||
std::string CMakeRoot;
|
std::string CMakeRoot;
|
||||||
|
|
||||||
cmCPackLog* Logger;
|
cmCPackLog* Logger;
|
||||||
|
private:
|
||||||
cmMakefile* Makefile;
|
cmMakefile* MakefileMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,11 +17,7 @@
|
||||||
|
|
||||||
#include "cmCPackZIPGenerator.h"
|
#include "cmCPackZIPGenerator.h"
|
||||||
|
|
||||||
#include "cmake.h"
|
|
||||||
#include "cmGlobalGenerator.h"
|
|
||||||
#include "cmLocalGenerator.h"
|
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmMakefile.h"
|
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmCPackLog.h"
|
#include "cmCPackLog.h"
|
||||||
|
|
||||||
|
@ -41,67 +37,14 @@ cmCPackZIPGenerator::~cmCPackZIPGenerator()
|
||||||
int cmCPackZIPGenerator::InitializeInternal()
|
int cmCPackZIPGenerator::InitializeInternal()
|
||||||
{
|
{
|
||||||
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
|
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
|
||||||
std::vector<std::string> path;
|
this->ReadListFile("CPackZIP.cmake");
|
||||||
std::string pkgPath = "c:/Program Files/WinZip";
|
if ((!this->IsSet("ZIP_EXECUTABLE"))
|
||||||
path.push_back(pkgPath);
|
|| (!this->IsSet("CPACK_ZIP_COMMAND")))
|
||||||
pkgPath = cmSystemTools::FindProgram("wzzip", path, false);
|
|
||||||
this->ZipStyle = cmCPackZIPGenerator::StyleUnkown;
|
|
||||||
bool found = false;
|
|
||||||
if ( pkgPath.empty() )
|
|
||||||
{
|
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Cannot find WinZip" << std::endl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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());
|
|
||||||
pkgPath = "c:/cygwin/bin";
|
|
||||||
path.push_back(pkgPath);
|
|
||||||
pkgPath = cmSystemTools::FindProgram("zip", path, false);
|
|
||||||
if ( pkgPath.empty() )
|
|
||||||
{
|
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Cannot find unix ZIP"
|
|
||||||
<< std::endl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->ZipStyle = cmCPackZIPGenerator::StyleUnixZip;
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !found )
|
|
||||||
{
|
{
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find a suitable ZIP program"
|
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find a suitable ZIP program"
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
|
|
||||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found ZIP program: "
|
|
||||||
<< pkgPath.c_str()
|
|
||||||
<< std::endl);
|
|
||||||
return this->Superclass::InitializeInternal();
|
return this->Superclass::InitializeInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,75 +55,46 @@ int cmCPackZIPGenerator::CompressFiles(const char* outFileName,
|
||||||
std::string tempFileName;
|
std::string tempFileName;
|
||||||
tempFileName = toplevel;
|
tempFileName = toplevel;
|
||||||
tempFileName += "/winZip.filelist";
|
tempFileName += "/winZip.filelist";
|
||||||
bool needQuotesInFile = false;
|
bool needQuotesInFile = cmSystemTools::IsOn(this->GetOption("CPACK_ZIP_NEED_QUOTES"));
|
||||||
cmOStringStream dmgCmd;
|
|
||||||
switch ( this->ZipStyle )
|
std::string cmd = this->GetOption("CPACK_ZIP_COMMAND");
|
||||||
|
cmsys::SystemTools::ReplaceString(cmd, "<ARCHIVE>", outFileName);
|
||||||
|
cmsys::SystemTools::ReplaceString(cmd, "<FILELIST>", "winZip.filelist");
|
||||||
|
|
||||||
|
{ // the scope is needed for cmGeneratedFileStream
|
||||||
|
cmGeneratedFileStream out(tempFileName.c_str());
|
||||||
|
std::vector<std::string>::const_iterator fileIt;
|
||||||
|
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
|
||||||
{
|
{
|
||||||
case cmCPackZIPGenerator::StyleWinZip:
|
if ( needQuotesInFile )
|
||||||
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
|
|
||||||
<< "\" -P \"" << 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
|
|
||||||
<< "\" . -i@winZip.filelist";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Unknown ZIP style"
|
|
||||||
<< std::endl);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if(tempFileName.size())
|
|
||||||
{
|
|
||||||
cmGeneratedFileStream out(tempFileName.c_str());
|
|
||||||
std::vector<std::string>::const_iterator fileIt;
|
|
||||||
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
|
|
||||||
{
|
{
|
||||||
if ( needQuotesInFile )
|
out << "\"";
|
||||||
{
|
|
||||||
out << "\"";
|
|
||||||
}
|
|
||||||
out << cmSystemTools::RelativePath(toplevel, fileIt->c_str());
|
|
||||||
if ( needQuotesInFile )
|
|
||||||
{
|
|
||||||
out << "\"";
|
|
||||||
}
|
|
||||||
out << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
out << cmSystemTools::RelativePath(toplevel, fileIt->c_str());
|
||||||
else
|
if ( needQuotesInFile )
|
||||||
{
|
|
||||||
std::vector<std::string>::const_iterator fileIt;
|
|
||||||
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
|
|
||||||
{
|
{
|
||||||
dmgCmd << " \""
|
out << "\"";
|
||||||
<< cmSystemTools::RelativePath(toplevel, fileIt->c_str())
|
|
||||||
<< "\"";
|
|
||||||
}
|
}
|
||||||
|
out << std::endl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string output;
|
std::string output;
|
||||||
int retVal = -1;
|
int retVal = -1;
|
||||||
int res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
|
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output,
|
||||||
&retVal, toplevel, this->GeneratorVerbose, 0);
|
&retVal, toplevel, this->GeneratorVerbose, 0);
|
||||||
|
|
||||||
if ( !res || retVal )
|
if ( !res || retVal )
|
||||||
{
|
{
|
||||||
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
|
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
|
||||||
tmpFile += "/CompressZip.log";
|
tmpFile += "/CompressZip.log";
|
||||||
cmGeneratedFileStream ofs(tmpFile.c_str());
|
cmGeneratedFileStream ofs(tmpFile.c_str());
|
||||||
ofs << "# Run command: " << dmgCmd.str().c_str() << std::endl
|
ofs << "# Run command: " << cmd.c_str() << std::endl
|
||||||
<< "# Output:" << std::endl
|
<< "# Output:" << std::endl
|
||||||
<< output.c_str() << std::endl;
|
<< output.c_str() << std::endl;
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running zip command: "
|
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running zip command: "
|
||||||
<< dmgCmd.str().c_str() << std::endl
|
<< cmd.c_str() << std::endl
|
||||||
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
|
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,14 +37,6 @@ public:
|
||||||
cmCPackZIPGenerator();
|
cmCPackZIPGenerator();
|
||||||
virtual ~cmCPackZIPGenerator();
|
virtual ~cmCPackZIPGenerator();
|
||||||
|
|
||||||
enum ZipStyles
|
|
||||||
{
|
|
||||||
StyleUnkown,
|
|
||||||
StyleWinZip,
|
|
||||||
StyleUnixZip,
|
|
||||||
Style7Zip
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int InitializeInternal();
|
virtual int InitializeInternal();
|
||||||
int CompressFiles(const char* outFileName, const char* toplevel,
|
int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
|
|
Loading…
Reference in New Issue