diff options
Diffstat (limited to 'Source/CPack/cmCPackBundleGenerator.cxx')
| -rw-r--r-- | Source/CPack/cmCPackBundleGenerator.cxx | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 4d5f43f..b3d425a 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -8,6 +8,7 @@ #include "cmCPackLog.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmValue.h" cmCPackBundleGenerator::cmCPackBundleGenerator() = default; @@ -15,8 +16,8 @@ cmCPackBundleGenerator::~cmCPackBundleGenerator() = default; int cmCPackBundleGenerator::InitializeInternal() { - const char* name = this->GetOption("CPACK_BUNDLE_NAME"); - if (nullptr == name) { + cmValue name = this->GetOption("CPACK_BUNDLE_NAME"); + if (!name) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_BUNDLE_NAME must be set to use the Bundle generator." << std::endl); @@ -33,7 +34,7 @@ int cmCPackBundleGenerator::InitializeInternal() "Cannot locate codesign command" << std::endl); return 0; } - this->SetOptionIfNotSet("CPACK_COMMAND_CODESIGN", codesign_path.c_str()); + this->SetOptionIfNotSet("CPACK_COMMAND_CODESIGN", codesign_path); } return this->Superclass::InitializeInternal(); @@ -51,30 +52,24 @@ int cmCPackBundleGenerator::ConstructBundle() { // Get required arguments ... - const std::string cpack_bundle_name = this->GetOption("CPACK_BUNDLE_NAME") - ? this->GetOption("CPACK_BUNDLE_NAME") - : ""; - if (cpack_bundle_name.empty()) { + cmValue cpack_bundle_name = this->GetOption("CPACK_BUNDLE_NAME"); + if (cpack_bundle_name->empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_BUNDLE_NAME must be set." << std::endl); return 0; } - const std::string cpack_bundle_plist = this->GetOption("CPACK_BUNDLE_PLIST") - ? this->GetOption("CPACK_BUNDLE_PLIST") - : ""; - if (cpack_bundle_plist.empty()) { + cmValue cpack_bundle_plist = this->GetOption("CPACK_BUNDLE_PLIST"); + if (cpack_bundle_plist->empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_BUNDLE_PLIST must be set." << std::endl); return 0; } - const std::string cpack_bundle_icon = this->GetOption("CPACK_BUNDLE_ICON") - ? this->GetOption("CPACK_BUNDLE_ICON") - : ""; - if (cpack_bundle_icon.empty()) { + cmValue cpack_bundle_icon = this->GetOption("CPACK_BUNDLE_ICON"); + if (cpack_bundle_icon->empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_BUNDLE_ICON must be set." << std::endl); @@ -82,10 +77,8 @@ int cmCPackBundleGenerator::ConstructBundle() } // Get optional arguments ... - const std::string cpack_bundle_startup_command = - this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") - ? this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") - : ""; + cmValue cpack_bundle_startup_command = + this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND"); // The staging directory contains everything that will end-up inside the // final disk image ... @@ -138,7 +131,7 @@ int cmCPackBundleGenerator::ConstructBundle() // Optionally a user-provided startup command (could be an // executable or a script) ... - if (!cpack_bundle_startup_command.empty()) { + if (!cpack_bundle_startup_command->empty()) { std::ostringstream command_source; command_source << cpack_bundle_startup_command; @@ -180,13 +173,11 @@ bool cmCPackBundleGenerator::SupportsComponentInstallation() const int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) { - const std::string cpack_apple_cert_app = - this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP") - ? this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP") - : ""; + cmValue cpack_apple_cert_app = + this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP"); // codesign the application. - if (!cpack_apple_cert_app.empty()) { + if (!cpack_apple_cert_app->empty()) { std::string output; std::string bundle_path; bundle_path = @@ -195,13 +186,10 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) // A list of additional files to sign, ie. frameworks and plugins. const std::string sign_parameter = this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") - ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") + ? *this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") : "--deep -f"; - const std::string sign_files = - this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") - ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") - : ""; + cmValue sign_files = this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES"); std::vector<std::string> relFiles = cmExpandedList(sign_files); |
