summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2009-01-22 13:56:13 -0500
committerDavid Cole <david.cole@kitware.com>2009-01-22 13:56:13 -0500
commit6bf31875ce3a87078ba3e90ce2e8cde44d561d86 (patch)
tree8be2d7b83f49f1028ddebea3d7197cffe8c990a2
parentc332e0bf3c4e619358322bd0d0961af45653eb5b (diff)
downloadcmake-6bf31875ce3a87078ba3e90ce2e8cde44d561d86.tar.gz
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.
-rw-r--r--Source/CPack/cmCPackBundleGenerator.cxx16
-rw-r--r--Source/CPack/cmCPackBundleGenerator.h1
-rw-r--r--Source/CPack/cmCPackLog.cxx6
-rw-r--r--Source/CPack/cpack.cxx5
4 files changed, 28 insertions, 0 deletions
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx
index d564308eeb..62183e62d9 100644
--- a/Source/CPack/cmCPackBundleGenerator.cxx
+++ b/Source/CPack/cmCPackBundleGenerator.cxx
@@ -32,6 +32,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()
{
this->InstallPrefix = "/";
diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h
index 04c57b4ec0..52c3c3a30c 100644
--- a/Source/CPack/cmCPackBundleGenerator.h
+++ b/Source/CPack/cmCPackBundleGenerator.h
@@ -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);
diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx
index 7b58039c41..82b990d947 100644
--- a/Source/CPack/cmCPackLog.cxx
+++ b/Source/CPack/cmCPackLog.cxx
@@ -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();
+ }
}
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 330d61f19b..51001aa00d 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -474,5 +474,10 @@ int main (int argc, char *argv[])
#define cout no_cout_use_cmCPack_Log
}
+ if (cmSystemTools::GetErrorOccuredFlag())
+ {
+ return 1;
+ }
+
return 0;
}