diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2021-09-05 13:44:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-09-13 13:54:27 (GMT) |
commit | 202a65759b98ed955af56db0415ae5033a90f740 (patch) | |
tree | 2e061a12db8ca4295987facfa96c1fb049e31220 /Source/CPack/IFW | |
parent | 9488f8a7b7c4b4f180d16cde8a819a7a5216ef56 (diff) | |
download | CMake-202a65759b98ed955af56db0415ae5033a90f740.zip CMake-202a65759b98ed955af56db0415ae5033a90f740.tar.gz CMake-202a65759b98ed955af56db0415ae5033a90f740.tar.bz2 |
cmCPackGenerator::GetOption returns cmProp
Diffstat (limited to 'Source/CPack/IFW')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWCommon.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWCommon.h | 4 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWGenerator.cxx | 57 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 112 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.cxx | 96 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWRepository.cxx | 25 |
6 files changed, 147 insertions, 149 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx index 87ebbfe..177a959 100644 --- a/Source/CPack/IFW/cmCPackIFWCommon.cxx +++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx @@ -21,7 +21,7 @@ cmCPackIFWCommon::cmCPackIFWCommon() { } -const char* cmCPackIFWCommon::GetOption(const std::string& op) const +cmProp cmCPackIFWCommon::GetOption(const std::string& op) const { return this->Generator ? this->Generator->cmCPackGenerator::GetOption(op) : nullptr; diff --git a/Source/CPack/IFW/cmCPackIFWCommon.h b/Source/CPack/IFW/cmCPackIFWCommon.h index 42deda4..cf243dc 100644 --- a/Source/CPack/IFW/cmCPackIFWCommon.h +++ b/Source/CPack/IFW/cmCPackIFWCommon.h @@ -7,6 +7,8 @@ #include <map> #include <string> +#include "cmProperty.h" + class cmCPackIFWGenerator; class cmXMLWriter; @@ -26,7 +28,7 @@ public: public: // Internal implementation - const char* GetOption(const std::string& op) const; + cmProp GetOption(const std::string& op) const; bool IsOn(const std::string& op) const; bool IsSetToOff(const std::string& op) const; bool IsSetToEmpty(const std::string& op) const; diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 2806c61..4993b40 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -14,6 +14,7 @@ #include "cmCPackLog.h" // IWYU pragma: keep #include "cmDuration.h" #include "cmGeneratedFileStream.h" +#include "cmProperty.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -250,7 +251,7 @@ const char* cmCPackIFWGenerator::GetPackagingInstallPrefix() this->SetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX", tmpPref.c_str()); - return this->GetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX"); + return this->GetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX")->c_str(); } const char* cmCPackIFWGenerator::GetOutputExtension() @@ -273,11 +274,11 @@ int cmCPackIFWGenerator::InitializeInternal() // Look 'binarycreator' executable (needs) - const char* BinCreatorStr = this->GetOption(BinCreatorOpt); + cmProp BinCreatorStr = this->GetOption(BinCreatorOpt); if (!BinCreatorStr || cmIsNOTFOUND(BinCreatorStr)) { this->BinCreator.clear(); } else { - this->BinCreator = BinCreatorStr; + this->BinCreator = *BinCreatorStr; } if (this->BinCreator.empty()) { @@ -290,16 +291,16 @@ int cmCPackIFWGenerator::InitializeInternal() // Look 'repogen' executable (optional) - const char* RepoGenStr = this->GetOption(RepoGenOpt); - if (!RepoGenStr || cmIsNOTFOUND(RepoGenStr)) { + cmProp repoGen = this->GetOption(RepoGenOpt); + if (!repoGen || cmIsNOTFOUND(repoGen)) { this->RepoGen.clear(); } else { - this->RepoGen = RepoGenStr; + this->RepoGen = *repoGen; } // Framework version - if (const char* FrameworkVersionSrt = this->GetOption(FrameworkVersionOpt)) { - this->FrameworkVersion = FrameworkVersionSrt; + if (cmProp frameworkVersion = this->GetOption(FrameworkVersionOpt)) { + this->FrameworkVersion = *frameworkVersion; } else { this->FrameworkVersion = "1.9.9"; } @@ -312,14 +313,13 @@ int cmCPackIFWGenerator::InitializeInternal() // Additional packages dirs this->PkgsDirsVector.clear(); - if (const char* dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) { + if (cmProp dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) { cmExpandList(dirs, this->PkgsDirsVector); } // Additional repositories dirs this->RepoDirsVector.clear(); - if (const char* dirs = - this->GetOption("CPACK_IFW_REPOSITORIES_DIRECTORIES")) { + if (cmProp dirs = this->GetOption("CPACK_IFW_REPOSITORIES_DIRECTORIES")) { cmExpandList(dirs, this->RepoDirsVector); } @@ -330,23 +330,22 @@ int cmCPackIFWGenerator::InitializeInternal() // Repository this->Repository.Generator = this; this->Repository.Name = "Unspecified"; - if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) { - this->Repository.Url = site; + if (cmProp site = this->GetOption("CPACK_DOWNLOAD_SITE")) { + this->Repository.Url = *site; this->Installer.RemoteRepositories.push_back(&this->Repository); } // Repositories - if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) { + if (cmProp RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) { std::vector<std::string> RepoAllVector = cmExpandedList(RepoAllStr); for (std::string const& r : RepoAllVector) { this->GetRepository(r); } } - if (const char* ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) { + if (cmProp ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) { this->OnlineOnly = cmIsOn(ifwDownloadAll); - } else if (const char* cpackDownloadAll = - this->GetOption("CPACK_DOWNLOAD_ALL")) { + } else if (cmProp cpackDownloadAll = this->GetOption("CPACK_DOWNLOAD_ALL")) { this->OnlineOnly = cmIsOn(cpackDownloadAll); } else { this->OnlineOnly = false; @@ -374,9 +373,8 @@ int cmCPackIFWGenerator::InitializeInternal() } // Output extension - if (const char* optOutExt = - this->GetOption("CPACK_IFW_PACKAGE_FILE_EXTENSION")) { - this->OutputExtension = optOutExt; + if (cmProp optOutExt = this->GetOption("CPACK_IFW_PACKAGE_FILE_EXTENSION")) { + this->OutputExtension = *optOutExt; } else if (sysName == "Darwin") { this->OutputExtension = ".dmg"; } else { @@ -508,21 +506,20 @@ std::string cmCPackIFWGenerator::GetRootPackageName() { // Default value std::string name = "root"; - if (const char* optIFW_PACKAGE_GROUP = + if (cmProp optIFW_PACKAGE_GROUP = this->GetOption("CPACK_IFW_PACKAGE_GROUP")) { // Configure from root group cmCPackIFWPackage package; package.Generator = this; package.ConfigureFromGroup(optIFW_PACKAGE_GROUP); name = package.Name; - } else if (const char* optIFW_PACKAGE_NAME = + } else if (cmProp optIFW_PACKAGE_NAME = this->GetOption("CPACK_IFW_PACKAGE_NAME")) { // Configure from root package name - name = optIFW_PACKAGE_NAME; - } else if (const char* optPACKAGE_NAME = - this->GetOption("CPACK_PACKAGE_NAME")) { + name = *optIFW_PACKAGE_NAME; + } else if (cmProp optPACKAGE_NAME = this->GetOption("CPACK_PACKAGE_NAME")) { // Configure from package name - name = optPACKAGE_NAME; + name = *optPACKAGE_NAME; } return name; } @@ -537,10 +534,10 @@ std::string cmCPackIFWGenerator::GetGroupPackageName( if (cmCPackIFWPackage* package = this->GetGroupPackage(group)) { return package->Name; } - const char* option = + cmProp option = this->GetOption("CPACK_IFW_COMPONENT_GROUP_" + cmsys::SystemTools::UpperCase(group->Name) + "_NAME"); - name = option ? option : group->Name; + name = option ? *option : group->Name; if (group->ParentGroup) { cmCPackIFWPackage* package = this->GetGroupPackage(group->ParentGroup); bool dot = !this->ResolveDuplicateNames; @@ -563,8 +560,8 @@ std::string cmCPackIFWGenerator::GetComponentPackageName( } std::string prefix = "CPACK_IFW_COMPONENT_" + cmsys::SystemTools::UpperCase(component->Name) + "_"; - const char* option = this->GetOption(prefix + "NAME"); - name = option ? option : component->Name; + cmProp option = this->GetOption(prefix + "NAME"); + name = option ? *option : component->Name; if (component->Group) { cmCPackIFWPackage* package = this->GetGroupPackage(component->Group); if ((this->componentPackageMethod == diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index bf8b457..23b73ff 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -12,6 +12,7 @@ #include "cmCPackIFWRepository.h" #include "cmCPackLog.h" // IWYU pragma: keep #include "cmGeneratedFileStream.h" +#include "cmProperty.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmXMLParser.h" @@ -33,61 +34,59 @@ void cmCPackIFWInstaller::printSkippedOptionWarning( void cmCPackIFWInstaller::ConfigureFromOptions() { // Name; - if (const char* optIFW_PACKAGE_NAME = - this->GetOption("CPACK_IFW_PACKAGE_NAME")) { - this->Name = optIFW_PACKAGE_NAME; - } else if (const char* optPACKAGE_NAME = - this->GetOption("CPACK_PACKAGE_NAME")) { - this->Name = optPACKAGE_NAME; + if (cmProp optIFW_PACKAGE_NAME = this->GetOption("CPACK_IFW_PACKAGE_NAME")) { + this->Name = *optIFW_PACKAGE_NAME; + } else if (cmProp optPACKAGE_NAME = this->GetOption("CPACK_PACKAGE_NAME")) { + this->Name = *optPACKAGE_NAME; } else { this->Name = "Your package"; } // Title; - if (const char* optIFW_PACKAGE_TITLE = + if (cmProp optIFW_PACKAGE_TITLE = this->GetOption("CPACK_IFW_PACKAGE_TITLE")) { - this->Title = optIFW_PACKAGE_TITLE; - } else if (const char* optPACKAGE_DESCRIPTION_SUMMARY = + this->Title = *optIFW_PACKAGE_TITLE; + } else if (cmProp optPACKAGE_DESCRIPTION_SUMMARY = this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) { - this->Title = optPACKAGE_DESCRIPTION_SUMMARY; + this->Title = *optPACKAGE_DESCRIPTION_SUMMARY; } else { this->Title = "Your package description"; } // Version; - if (const char* option = this->GetOption("CPACK_PACKAGE_VERSION")) { - this->Version = option; + if (cmProp option = this->GetOption("CPACK_PACKAGE_VERSION")) { + this->Version = *option; } else { this->Version = "1.0.0"; } // Publisher - if (const char* optIFW_PACKAGE_PUBLISHER = + if (cmProp optIFW_PACKAGE_PUBLISHER = this->GetOption("CPACK_IFW_PACKAGE_PUBLISHER")) { - this->Publisher = optIFW_PACKAGE_PUBLISHER; - } else if (const char* optPACKAGE_VENDOR = + this->Publisher = *optIFW_PACKAGE_PUBLISHER; + } else if (cmProp optPACKAGE_VENDOR = this->GetOption("CPACK_PACKAGE_VENDOR")) { - this->Publisher = optPACKAGE_VENDOR; + this->Publisher = *optPACKAGE_VENDOR; } // ProductUrl - if (const char* option = this->GetOption("CPACK_IFW_PRODUCT_URL")) { - this->ProductUrl = option; + if (cmProp option = this->GetOption("CPACK_IFW_PRODUCT_URL")) { + this->ProductUrl = *option; } // ApplicationIcon - if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_ICON")) { + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_ICON")) { if (cmSystemTools::FileExists(option)) { - this->InstallerApplicationIcon = option; + this->InstallerApplicationIcon = *option; } else { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option); } } // WindowIcon - if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) { + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) { if (cmSystemTools::FileExists(option)) { - this->InstallerWindowIcon = option; + this->InstallerWindowIcon = *option; } else { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option); } @@ -103,45 +102,45 @@ void cmCPackIFWInstaller::ConfigureFromOptions() } // Logo - if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_LOGO")) { + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_LOGO")) { if (cmSystemTools::FileExists(option)) { - this->Logo = option; + this->Logo = *option; } else { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option); } } // Watermark - if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WATERMARK")) { + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_WATERMARK")) { if (cmSystemTools::FileExists(option)) { - this->Watermark = option; + this->Watermark = *option; } else { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option); } } // Banner - if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_BANNER")) { + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_BANNER")) { if (cmSystemTools::FileExists(option)) { - this->Banner = option; + this->Banner = *option; } else { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option); } } // Background - if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) { + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) { if (cmSystemTools::FileExists(option)) { - this->Background = option; + this->Background = *option; } else { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option); } } // WizardStyle - if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) { + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) { // Setting the user value in any case - this->WizardStyle = option; + this->WizardStyle = *option; // Check known values if (this->WizardStyle != "Modern" && this->WizardStyle != "Aero" && this->WizardStyle != "Mac" && this->WizardStyle != "Classic") { @@ -154,28 +153,28 @@ void cmCPackIFWInstaller::ConfigureFromOptions() } // StyleSheet - if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_STYLE_SHEET")) { + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_STYLE_SHEET")) { if (cmSystemTools::FileExists(option)) { - this->StyleSheet = option; + this->StyleSheet = *option; } else { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_STYLE_SHEET", option); } } // WizardDefaultWidth - if (const char* option = + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) { - this->WizardDefaultWidth = option; + this->WizardDefaultWidth = *option; } // WizardDefaultHeight - if (const char* option = + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT")) { - this->WizardDefaultHeight = option; + this->WizardDefaultHeight = *option; } // WizardShowPageList - if (const char* option = + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST")) { if (!this->IsVersionLess("4.0")) { if (this->IsSetToOff("CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST")) { @@ -204,23 +203,23 @@ void cmCPackIFWInstaller::ConfigureFromOptions() } // TitleColor - if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) { - this->TitleColor = option; + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) { + this->TitleColor = *option; } // Start menu - if (const char* optIFW_START_MENU_DIR = + if (cmProp optIFW_START_MENU_DIR = this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY")) { - this->StartMenuDir = optIFW_START_MENU_DIR; + this->StartMenuDir = *optIFW_START_MENU_DIR; } else { this->StartMenuDir = this->Name; } // Default target directory for installation - if (const char* optIFW_TARGET_DIRECTORY = + if (cmProp optIFW_TARGET_DIRECTORY = this->GetOption("CPACK_IFW_TARGET_DIRECTORY")) { - this->TargetDir = optIFW_TARGET_DIRECTORY; - } else if (const char* optPACKAGE_INSTALL_DIRECTORY = + this->TargetDir = *optIFW_TARGET_DIRECTORY; + } else if (cmProp optPACKAGE_INSTALL_DIRECTORY = this->GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) { this->TargetDir = cmStrCat("@ApplicationsDir@/", optPACKAGE_INSTALL_DIRECTORY); @@ -229,21 +228,20 @@ void cmCPackIFWInstaller::ConfigureFromOptions() } // Default target directory for installation with administrator rights - if (const char* option = - this->GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY")) { - this->AdminTargetDir = option; + if (cmProp option = this->GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY")) { + this->AdminTargetDir = *option; } // Maintenance tool - if (const char* optIFW_MAINTENANCE_TOOL = + if (cmProp optIFW_MAINTENANCE_TOOL = this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME")) { - this->MaintenanceToolName = optIFW_MAINTENANCE_TOOL; + this->MaintenanceToolName = *optIFW_MAINTENANCE_TOOL; } // Maintenance tool ini file - if (const char* optIFW_MAINTENANCE_TOOL_INI = + if (cmProp optIFW_MAINTENANCE_TOOL_INI = this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE")) { - this->MaintenanceToolIniFile = optIFW_MAINTENANCE_TOOL_INI; + this->MaintenanceToolIniFile = *optIFW_MAINTENANCE_TOOL_INI; } // Allow non-ASCII characters @@ -265,13 +263,13 @@ void cmCPackIFWInstaller::ConfigureFromOptions() } // Control script - if (const char* optIFW_CONTROL_SCRIPT = + if (cmProp optIFW_CONTROL_SCRIPT = this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) { - this->ControlScript = optIFW_CONTROL_SCRIPT; + this->ControlScript = *optIFW_CONTROL_SCRIPT; } // Resources - if (const char* optIFW_PACKAGE_RESOURCES = + if (cmProp optIFW_PACKAGE_RESOURCES = this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) { this->Resources.clear(); cmExpandList(optIFW_PACKAGE_RESOURCES, this->Resources); @@ -541,7 +539,7 @@ void cmCPackIFWInstaller::GeneratePackageFiles() package.Generator = this->Generator; package.Installer = this; // Check package group - if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_GROUP")) { + if (cmProp option = this->GetOption("CPACK_IFW_PACKAGE_GROUP")) { package.ConfigureFromGroup(option); std::string forcedOption = "CPACK_IFW_COMPONENT_GROUP_" + cmsys::SystemTools::UpperCase(option) + "_FORCED_INSTALLATION"; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 1429c46..c1e11d2 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -15,6 +15,7 @@ #include "cmCPackIFWInstaller.h" #include "cmCPackLog.h" // IWYU pragma: keep #include "cmGeneratedFileStream.h" +#include "cmProperty.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTimestamp.h" @@ -124,10 +125,10 @@ std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component) if (!component) { return ""; } - const char* option = + cmProp option = this->GetOption("CPACK_IFW_COMPONENT_" + cmsys::SystemTools::UpperCase(component->Name) + "_NAME"); - return option ? option : component->Name; + return option ? *option : component->Name; } void cmCPackIFWPackage::DefaultConfiguration() @@ -159,23 +160,22 @@ int cmCPackIFWPackage::ConfigureFromOptions() this->Name = this->Generator->GetRootPackageName(); // Display name - if (const char* option = this->GetOption("CPACK_PACKAGE_NAME")) { - this->DisplayName[""] = option; + if (cmProp option = this->GetOption("CPACK_PACKAGE_NAME")) { + this->DisplayName[""] = *option; } else { this->DisplayName[""] = "Your package"; } // Description - if (const char* option = - this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) { - this->Description[""] = option; + if (cmProp option = this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) { + this->Description[""] = *option; } else { this->Description[""] = "Your package description"; } // Version - if (const char* option = this->GetOption("CPACK_PACKAGE_VERSION")) { - this->Version = option; + if (cmProp option = this->GetOption("CPACK_PACKAGE_VERSION")) { + this->Version = *option; } else { this->Version = "1.0.0"; } @@ -204,22 +204,22 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) this->Description[""] = component->Description; // Version - if (const char* optVERSION = this->GetOption(prefix + "VERSION")) { - this->Version = optVERSION; - } else if (const char* optPACKAGE_VERSION = + if (cmProp optVERSION = this->GetOption(prefix + "VERSION")) { + this->Version = *optVERSION; + } else if (cmProp optPACKAGE_VERSION = this->GetOption("CPACK_PACKAGE_VERSION")) { - this->Version = optPACKAGE_VERSION; + this->Version = *optPACKAGE_VERSION; } else { this->Version = "1.0.0"; } // Script - if (const char* option = this->GetOption(prefix + "SCRIPT")) { - this->Script = option; + if (cmProp option = this->GetOption(prefix + "SCRIPT")) { + this->Script = *option; } // User interfaces - if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) { + if (cmProp option = this->GetOption(prefix + "USER_INTERFACES")) { this->UserInterfaces.clear(); cmExpandList(option, this->UserInterfaces); } @@ -232,7 +232,7 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) } // Licenses - if (const char* option = this->GetOption(prefix + "LICENSES")) { + if (cmProp option = this->GetOption(prefix + "LICENSES")) { this->Licenses.clear(); cmExpandList(option, this->Licenses); if (this->Licenses.size() % 2 != 0) { @@ -246,8 +246,8 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) } // Priority - if (const char* option = this->GetOption(prefix + "PRIORITY")) { - this->SortingPriority = option; + if (cmProp option = this->GetOption(prefix + "PRIORITY")) { + this->SortingPriority = *option; cmCPackIFWLogger( WARNING, "The \"PRIORITY\" option is set " @@ -289,28 +289,28 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) this->Description[""] = group->Description; // Version - if (const char* optVERSION = this->GetOption(prefix + "VERSION")) { - this->Version = optVERSION; - } else if (const char* optPACKAGE_VERSION = + if (cmProp optVERSION = this->GetOption(prefix + "VERSION")) { + this->Version = *optVERSION; + } else if (cmProp optPACKAGE_VERSION = this->GetOption("CPACK_PACKAGE_VERSION")) { - this->Version = optPACKAGE_VERSION; + this->Version = *optPACKAGE_VERSION; } else { this->Version = "1.0.0"; } // Script - if (const char* option = this->GetOption(prefix + "SCRIPT")) { - this->Script = option; + if (cmProp option = this->GetOption(prefix + "SCRIPT")) { + this->Script = *option; } // User interfaces - if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) { + if (cmProp option = this->GetOption(prefix + "USER_INTERFACES")) { this->UserInterfaces.clear(); cmExpandList(option, this->UserInterfaces); } // Licenses - if (const char* option = this->GetOption(prefix + "LICENSES")) { + if (cmProp option = this->GetOption(prefix + "LICENSES")) { this->Licenses.clear(); cmExpandList(option, this->Licenses); if (this->Licenses.size() % 2 != 0) { @@ -324,8 +324,8 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) } // Priority - if (const char* option = this->GetOption(prefix + "PRIORITY")) { - this->SortingPriority = option; + if (cmProp option = this->GetOption(prefix + "PRIORITY")) { + this->SortingPriority = *option; cmCPackIFWLogger( WARNING, "The \"PRIORITY\" option is set " @@ -346,14 +346,14 @@ int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName) std::string prefix = "CPACK_COMPONENT_GROUP_" + cmsys::SystemTools::UpperCase(groupName) + "_"; - if (const char* option = this->GetOption(prefix + "DISPLAY_NAME")) { - group.DisplayName = option; + if (cmProp option = this->GetOption(prefix + "DISPLAY_NAME")) { + group.DisplayName = *option; } else { group.DisplayName = group.Name; } - if (const char* option = this->GetOption(prefix + "DESCRIPTION")) { - group.Description = option; + if (cmProp option = this->GetOption(prefix + "DESCRIPTION")) { + group.Description = *option; } group.IsBold = this->IsOn(prefix + "BOLD_TITLE"); group.IsExpandedByDefault = this->IsOn(prefix + "EXPANDED"); @@ -381,7 +381,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) option = prefix + "DISPLAY_NAME"; if (this->IsSetToEmpty(option)) { this->DisplayName.clear(); - } else if (const char* value = this->GetOption(option)) { + } else if (cmProp value = this->GetOption(option)) { cmCPackIFWPackage::ExpandListArgument(value, this->DisplayName); } @@ -389,7 +389,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) option = prefix + "DESCRIPTION"; if (this->IsSetToEmpty(option)) { this->Description.clear(); - } else if (const char* value = this->GetOption(option)) { + } else if (cmProp value = this->GetOption(option)) { cmCPackIFWPackage::ExpandListArgument(value, this->Description); } @@ -397,31 +397,31 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) option = prefix + "RELEASE_DATE"; if (this->IsSetToEmpty(option)) { this->ReleaseDate.clear(); - } else if (const char* value = this->GetOption(option)) { - this->ReleaseDate = value; + } else if (cmProp value = this->GetOption(option)) { + this->ReleaseDate = *value; } // Sorting priority option = prefix + "SORTING_PRIORITY"; if (this->IsSetToEmpty(option)) { this->SortingPriority.clear(); - } else if (const char* value = this->GetOption(option)) { - this->SortingPriority = value; + } else if (cmProp value = this->GetOption(option)) { + this->SortingPriority = *value; } // Update text option = prefix + "UPDATE_TEXT"; if (this->IsSetToEmpty(option)) { this->UpdateText.clear(); - } else if (const char* value = this->GetOption(option)) { - this->UpdateText = value; + } else if (cmProp value = this->GetOption(option)) { + this->UpdateText = *value; } // Translations option = prefix + "TRANSLATIONS"; if (this->IsSetToEmpty(option)) { this->Translations.clear(); - } else if (const char* value = this->GetOption(option)) { + } else if (cmProp value = this->GetOption(option)) { this->Translations.clear(); cmExpandList(value, this->Translations); } @@ -429,11 +429,11 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) // QtIFW dependencies std::vector<std::string> deps; option = prefix + "DEPENDS"; - if (const char* value = this->GetOption(option)) { + if (cmProp value = this->GetOption(option)) { cmExpandList(value, deps); } option = prefix + "DEPENDENCIES"; - if (const char* value = this->GetOption(option)) { + if (cmProp value = this->GetOption(option)) { cmExpandList(value, deps); } for (std::string const& d : deps) { @@ -454,7 +454,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) option = prefix + "AUTO_DEPEND_ON"; if (this->IsSetToEmpty(option)) { this->AlienAutoDependOn.clear(); - } else if (const char* value = this->GetOption(option)) { + } else if (cmProp value = this->GetOption(option)) { std::vector<std::string> depsOn = cmExpandedList(value); for (std::string const& d : depsOn) { DependenceStruct dep(d); @@ -483,7 +483,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) option = prefix + "DEFAULT"; if (this->IsSetToEmpty(option)) { this->Default.clear(); - } else if (const char* value = this->GetOption(option)) { + } else if (cmProp value = this->GetOption(option)) { std::string lowerValue = cmsys::SystemTools::LowerCase(value); if (lowerValue == "true") { this->Default = "true"; @@ -492,7 +492,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) } else if (lowerValue == "script") { this->Default = "script"; } else { - this->Default = value; + this->Default = *value; } } @@ -510,7 +510,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) option = prefix + "REPLACES"; if (this->IsSetToEmpty(option)) { this->Replaces.clear(); - } else if (const char* value = this->GetOption(option)) { + } else if (cmProp value = this->GetOption(option)) { this->Replaces.clear(); cmExpandList(value, this->Replaces); } diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index 7ec2256..cc64e93 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -6,6 +6,7 @@ #include "cmCPackIFWGenerator.h" #include "cmGeneratedFileStream.h" +#include "cmProperty.h" #include "cmSystemTools.h" #include "cmXMLParser.h" #include "cmXMLWriter.h" @@ -55,22 +56,22 @@ bool cmCPackIFWRepository::ConfigureFromOptions() } // Url - if (const char* url = this->GetOption(prefix + "URL")) { - this->Url = url; + if (cmProp url = this->GetOption(prefix + "URL")) { + this->Url = *url; } else { this->Url.clear(); } // Old url - if (const char* oldUrl = this->GetOption(prefix + "OLD_URL")) { - this->OldUrl = oldUrl; + if (cmProp oldUrl = this->GetOption(prefix + "OLD_URL")) { + this->OldUrl = *oldUrl; } else { this->OldUrl.clear(); } // New url - if (const char* newUrl = this->GetOption(prefix + "NEW_URL")) { - this->NewUrl = newUrl; + if (cmProp newUrl = this->GetOption(prefix + "NEW_URL")) { + this->NewUrl = *newUrl; } else { this->NewUrl.clear(); } @@ -83,22 +84,22 @@ bool cmCPackIFWRepository::ConfigureFromOptions() } // Username - if (const char* username = this->GetOption(prefix + "USERNAME")) { - this->Username = username; + if (cmProp username = this->GetOption(prefix + "USERNAME")) { + this->Username = *username; } else { this->Username.clear(); } // Password - if (const char* password = this->GetOption(prefix + "PASSWORD")) { - this->Password = password; + if (cmProp password = this->GetOption(prefix + "PASSWORD")) { + this->Password = *password; } else { this->Password.clear(); } // DisplayName - if (const char* displayName = this->GetOption(prefix + "DISPLAY_NAME")) { - this->DisplayName = displayName; + if (cmProp displayName = this->GetOption(prefix + "DISPLAY_NAME")) { + this->DisplayName = *displayName; } else { this->DisplayName.clear(); } |