diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-12-04 14:09:55 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-12-04 14:09:55 (GMT) |
commit | 81515ba8a58dcaba6f564d6f59bd4abf7235a316 (patch) | |
tree | 461b485fea7f6f7d5b9698f2b855b014adb530b3 /Source | |
parent | 68cf9e0a0df1cf40ee5da0f25057a82b31d97ec3 (diff) | |
download | CMake-81515ba8a58dcaba6f564d6f59bd4abf7235a316.zip CMake-81515ba8a58dcaba6f564d6f59bd4abf7235a316.tar.gz CMake-81515ba8a58dcaba6f564d6f59bd4abf7235a316.tar.bz2 |
ENH: allow startup command to be optional
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackBundleGenerator.cxx | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 5a4ebd1..d1ecdd8 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -113,22 +113,14 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, return 0; } - const std::string cpack_bundle_startup_command = - this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") ? - this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") : ""; - if(cpack_bundle_startup_command.empty()) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "CPACK_BUNDLE_STARTUP_COMMAND must be set." - << std::endl); - - return 0; - } - // Get optional arguments ... const std::string cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON") ? this->GetOption("CPACK_PACKAGE_ICON") : ""; + const std::string cpack_bundle_startup_command = + this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") + ? this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") : ""; + // The staging directory contains everything that will end-up inside the // final disk image ... cmOStringStream staging; @@ -176,26 +168,29 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName, return 0; } - // Install a user-provided startup command (could be an executable or a - // script) ... - cmOStringStream command_source; - command_source << cpack_bundle_startup_command; + // Optionally a user-provided startup command (could be an + // executable or a script) ... + if(!cpack_bundle_startup_command.empty()) + { + cmOStringStream command_source; + command_source << cpack_bundle_startup_command; + + cmOStringStream command_target; + command_target << application.str() << "/" << cpack_bundle_name; - cmOStringStream command_target; - command_target << application.str() << "/" << cpack_bundle_name; + if(!this->CopyFile(command_source, command_target)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error copying startup command. " + " Check the value of CPACK_BUNDLE_STARTUP_COMMAND." + << std::endl); - if(!this->CopyFile(command_source, command_target)) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error copying startup command. " - " Check the value of CPACK_BUNDLE_STARTUP_COMMAND." - << std::endl); + return 0; + } - return 0; + cmSystemTools::SetPermissions(command_target.str().c_str(), 0777); } - cmSystemTools::SetPermissions(command_target.str().c_str(), 0777); - // Add a symlink to /Applications so users can drag-and-drop the bundle // into it cmOStringStream application_link; |