Commit 6bf31875 authored by David Cole's avatar David Cole
Browse files

BUG: Fix issue #8383. Avoid crashing when using the Bundle CPack generator and...

BUG: Fix issue #8383. Avoid crashing when using the Bundle CPack generator and CPACK_BUNDLE_NAME is not set. Instead, fail gracefully giving an informative error message and non-zero exit code.
parent c332e0bf
......@@ -31,6 +31,22 @@ cmCPackBundleGenerator::~cmCPackBundleGenerator()
{
}
//----------------------------------------------------------------------
int cmCPackBundleGenerator::InitializeInternal()
{
const char* name = this->GetOption("CPACK_BUNDLE_NAME");
if(0 == name)
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_BUNDLE_NAME must be set to use the Bundle generator."
<< std::endl);
return 0;
}
return this->Superclass::InitializeInternal();
}
//----------------------------------------------------------------------
const char* cmCPackBundleGenerator::GetPackagingInstallPrefix()
{
......
......@@ -34,6 +34,7 @@ public:
virtual ~cmCPackBundleGenerator();
protected:
virtual int InitializeInternal();
virtual const char* GetPackagingInstallPrefix();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
......
......@@ -18,6 +18,7 @@
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
//----------------------------------------------------------------------
cmCPackLog::cmCPackLog()
......@@ -221,4 +222,9 @@ void cmCPackLog::Log(int tag, const char* file, int line,
{
this->NewLine = true;
}
if ( error )
{
cmSystemTools::SetErrorOccured();
}
}
......@@ -474,5 +474,10 @@ int main (int argc, char *argv[])
#define cout no_cout_use_cmCPack_Log
}
if (cmSystemTools::GetErrorOccuredFlag())
{
return 1;
}
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment