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.
This commit is contained in:
parent
c332e0bf3c
commit
6bf31875ce
@ -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()
|
const char* cmCPackBundleGenerator::GetPackagingInstallPrefix()
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,7 @@ public:
|
|||||||
virtual ~cmCPackBundleGenerator();
|
virtual ~cmCPackBundleGenerator();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual int InitializeInternal();
|
||||||
virtual const char* GetPackagingInstallPrefix();
|
virtual const char* GetPackagingInstallPrefix();
|
||||||
int CompressFiles(const char* outFileName, const char* toplevel,
|
int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "cmCPackLog.h"
|
#include "cmCPackLog.h"
|
||||||
|
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
cmCPackLog::cmCPackLog()
|
cmCPackLog::cmCPackLog()
|
||||||
@ -221,4 +222,9 @@ void cmCPackLog::Log(int tag, const char* file, int line,
|
|||||||
{
|
{
|
||||||
this->NewLine = true;
|
this->NewLine = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( error )
|
||||||
|
{
|
||||||
|
cmSystemTools::SetErrorOccured();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -474,5 +474,10 @@ int main (int argc, char *argv[])
|
|||||||
#define cout no_cout_use_cmCPack_Log
|
#define cout no_cout_use_cmCPack_Log
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmSystemTools::GetErrorOccuredFlag())
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user