ENH: allow startup command to be optional

This commit is contained in:
Bill Hoffman 2008-12-04 09:09:55 -05:00
parent 68cf9e0a0d
commit 81515ba8a5

View File

@ -113,22 +113,14 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName,
return 0; 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 ... // Get optional arguments ...
const std::string cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON") const std::string cpack_package_icon = this->GetOption("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 // The staging directory contains everything that will end-up inside the
// final disk image ... // final disk image ...
cmOStringStream staging; cmOStringStream staging;
@ -176,8 +168,10 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName,
return 0; return 0;
} }
// Install a user-provided startup command (could be an executable or a // Optionally a user-provided startup command (could be an
// script) ... // executable or a script) ...
if(!cpack_bundle_startup_command.empty())
{
cmOStringStream command_source; cmOStringStream command_source;
command_source << cpack_bundle_startup_command; command_source << cpack_bundle_startup_command;
@ -195,6 +189,7 @@ int cmCPackBundleGenerator::CompressFiles(const char* outFileName,
} }
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 // Add a symlink to /Applications so users can drag-and-drop the bundle
// into it // into it