diff options
author | David Cole <david.cole@kitware.com> | 2009-01-22 18:56:13 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2009-01-22 18:56:13 (GMT) |
commit | 6bf31875ce3a87078ba3e90ce2e8cde44d561d86 (patch) | |
tree | 8be2d7b83f49f1028ddebea3d7197cffe8c990a2 /Source/CPack | |
parent | c332e0bf3c4e619358322bd0d0961af45653eb5b (diff) | |
download | CMake-6bf31875ce3a87078ba3e90ce2e8cde44d561d86.zip CMake-6bf31875ce3a87078ba3e90ce2e8cde44d561d86.tar.gz CMake-6bf31875ce3a87078ba3e90ce2e8cde44d561d86.tar.bz2 |
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.
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/cmCPackBundleGenerator.cxx | 16 | ||||
-rw-r--r-- | Source/CPack/cmCPackBundleGenerator.h | 1 | ||||
-rw-r--r-- | Source/CPack/cmCPackLog.cxx | 6 | ||||
-rw-r--r-- | Source/CPack/cpack.cxx | 5 |
4 files changed, 28 insertions, 0 deletions
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index d564308..62183e6 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 04c57b4..52c3c3a 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 7b58039..82b990d 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 330d61f..51001aa 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; } |