summaryrefslogtreecommitdiff
path: root/Source/CPack/WiX
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CPack/WiX')
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx79
1 files changed, 38 insertions, 41 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 8b3644f910..7ec2c3f1c4 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -18,6 +18,7 @@
#include "cmCryptoHash.h"
#include "cmGeneratedFileStream.h"
#include "cmInstalledFile.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmUuid.h"
@@ -125,7 +126,7 @@ bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles)
command << " -ext " << QuotePath(ext);
}
- const char* const cultures = GetOption("CPACK_WIX_CULTURES");
+ cmProp const cultures = GetOption("CPACK_WIX_CULTURES");
if (cultures) {
command << " -cultures:" << cultures;
}
@@ -156,7 +157,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
return false;
}
- if (GetOption("CPACK_WIX_PRODUCT_GUID") == 0) {
+ if (!GetOption("CPACK_WIX_PRODUCT_GUID")) {
std::string guid = GenerateGUID();
SetOption("CPACK_WIX_PRODUCT_GUID", guid.c_str());
@@ -165,7 +166,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
<< std::endl);
}
- if (GetOption("CPACK_WIX_UPGRADE_GUID") == 0) {
+ if (!GetOption("CPACK_WIX_UPGRADE_GUID")) {
std::string guid = GenerateGUID();
SetOption("CPACK_WIX_UPGRADE_GUID", guid.c_str());
@@ -182,7 +183,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
return false;
}
- if (GetOption("CPACK_WIX_LICENSE_RTF") == 0) {
+ if (!GetOption("CPACK_WIX_LICENSE_RTF")) {
std::string licenseFilename = this->CPackTopLevel + "/License.rtf";
SetOption("CPACK_WIX_LICENSE_RTF", licenseFilename.c_str());
@@ -191,7 +192,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
}
}
- if (GetOption("CPACK_PACKAGE_VENDOR") == 0) {
+ if (!GetOption("CPACK_PACKAGE_VENDOR")) {
std::string defaultVendor = "Humanity";
SetOption("CPACK_PACKAGE_VENDOR", defaultVendor.c_str());
@@ -200,7 +201,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
<< defaultVendor << " . " << std::endl);
}
- if (GetOption("CPACK_WIX_UI_REF") == 0) {
+ if (!GetOption("CPACK_WIX_UI_REF")) {
std::string defaultRef = "WixUI_InstallDir";
if (!this->Components.empty()) {
@@ -210,9 +211,9 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
SetOption("CPACK_WIX_UI_REF", defaultRef.c_str());
}
- const char* packageContact = GetOption("CPACK_PACKAGE_CONTACT");
- if (packageContact != 0 && GetOption("CPACK_WIX_PROPERTY_ARPCONTACT") == 0) {
- SetOption("CPACK_WIX_PROPERTY_ARPCONTACT", packageContact);
+ cmProp packageContact = GetOption("CPACK_PACKAGE_CONTACT");
+ if (packageContact && !GetOption("CPACK_WIX_PROPERTY_ARPCONTACT")) {
+ SetOption("CPACK_WIX_PROPERTY_ARPCONTACT", packageContact->c_str());
}
CollectExtensions("CPACK_WIX_EXTENSIONS", this->CandleExtensions);
@@ -223,7 +224,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", this->LightExtensions);
CollectXmlNamespaces("CPACK_WIX_CUSTOM_XMLNS", this->CustomXmlNamespaces);
- const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE");
+ cmProp patchFilePath = GetOption("CPACK_WIX_PATCH_FILE");
if (patchFilePath) {
std::vector<std::string> patchFilePaths = cmExpandedList(patchFilePath);
@@ -295,7 +296,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
void cmCPackWIXGenerator::AppendUserSuppliedExtraSources()
{
- const char* cpackWixExtraSources = GetOption("CPACK_WIX_EXTRA_SOURCES");
+ cmProp cpackWixExtraSources = GetOption("CPACK_WIX_EXTRA_SOURCES");
if (!cpackWixExtraSources)
return;
@@ -304,7 +305,7 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraSources()
void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream)
{
- const char* cpackWixExtraObjects = GetOption("CPACK_WIX_EXTRA_OBJECTS");
+ cmProp cpackWixExtraObjects = GetOption("CPACK_WIX_EXTRA_OBJECTS");
if (!cpackWixExtraObjects)
return;
@@ -335,7 +336,7 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile()
CopyDefinition(includeFile, "CPACK_WIX_UI_BANNER", DefinitionType::PATH);
CopyDefinition(includeFile, "CPACK_WIX_UI_DIALOG", DefinitionType::PATH);
SetOptionIfNotSet("CPACK_WIX_PROGRAM_MENU_FOLDER",
- GetOption("CPACK_PACKAGE_NAME"));
+ GetOption("CPACK_PACKAGE_NAME").GetCStr());
CopyDefinition(includeFile, "CPACK_WIX_PROGRAM_MENU_FOLDER");
CopyDefinition(includeFile, "CPACK_WIX_UI_REF");
}
@@ -355,7 +356,7 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile()
for (std::string const& name : options) {
if (cmHasPrefix(name, prefix)) {
std::string id = name.substr(prefix.length());
- std::string value = GetOption(name.c_str());
+ std::string value = GetOption(name);
includeFile.BeginElement("Property");
includeFile.AddAttribute("Id", id);
@@ -364,7 +365,7 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile()
}
}
- if (GetOption("CPACK_WIX_PROPERTY_ARPINSTALLLOCATION") == 0) {
+ if (!GetOption("CPACK_WIX_PROPERTY_ARPINSTALLLOCATION")) {
includeFile.BeginElement("Property");
includeFile.AddAttribute("Id", "INSTALL_ROOT");
includeFile.AddAttribute("Secure", "yes");
@@ -405,7 +406,7 @@ void cmCPackWIXGenerator::CopyDefinition(cmWIXSourceWriter& source,
std::string const& name,
DefinitionType type)
{
- const char* value = GetOption(name.c_str());
+ cmProp value = GetOption(name);
if (value) {
if (type == DefinitionType::PATH) {
AddDefinition(source, name, CMakeToWixPath(value));
@@ -485,17 +486,17 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
}
std::string featureTitle = cpackPackageName;
- if (const char* title = GetOption("CPACK_WIX_ROOT_FEATURE_TITLE")) {
- featureTitle = title;
+ if (cmProp title = GetOption("CPACK_WIX_ROOT_FEATURE_TITLE")) {
+ featureTitle = *title;
}
featureDefinitions.AddAttribute("Title", featureTitle);
- if (const char* desc = GetOption("CPACK_WIX_ROOT_FEATURE_DESCRIPTION")) {
+ if (cmProp desc = GetOption("CPACK_WIX_ROOT_FEATURE_DESCRIPTION")) {
featureDefinitions.AddAttribute("Description", desc);
}
featureDefinitions.AddAttribute("Level", "1");
this->Patch->ApplyFragment("#PRODUCTFEATURE", featureDefinitions);
- const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY");
+ cmProp package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY");
if (package) {
featureDefinitions.CreateCMakePackageRegistryEntry(
package, GetOption("CPACK_WIX_UPGRADE_GUID"));
@@ -540,10 +541,9 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
}
bool emitUninstallShortcut = true;
- const char* cpackWixProgramMenuFolder =
+ cmProp cpackWixProgramMenuFolder =
GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER");
- if (cpackWixProgramMenuFolder &&
- cm::string_view(cpackWixProgramMenuFolder) == ".") {
+ if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder == ".") {
emitUninstallShortcut = false;
} else if (emittedShortcutTypes.find(cmWIXShortcuts::START_MENU) ==
emittedShortcutTypes.end()) {
@@ -595,9 +595,9 @@ std::string cmCPackWIXGenerator::GetRootFolderId() const
std::string result = "ProgramFiles<64>Folder";
- const char* rootFolderId = GetOption("CPACK_WIX_ROOT_FOLDER_ID");
+ cmProp rootFolderId = GetOption("CPACK_WIX_ROOT_FOLDER_ID");
if (rootFolderId) {
- result = rootFolderId;
+ result = *rootFolderId;
}
if (GetArchitecture() == "x86") {
@@ -612,8 +612,8 @@ std::string cmCPackWIXGenerator::GetRootFolderId() const
bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
{
std::string wixTemplate = FindTemplate("WIX.template.in");
- if (GetOption("CPACK_WIX_TEMPLATE") != 0) {
- wixTemplate = GetOption("CPACK_WIX_TEMPLATE");
+ if (cmProp wixtpl = GetOption("CPACK_WIX_TEMPLATE")) {
+ wixTemplate = *wixtpl;
}
if (wixTemplate.empty()) {
@@ -669,7 +669,7 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
featureDefinitions.AddAttribute("Id", featureId);
std::vector<std::string> cpackPackageExecutablesList;
- const char* cpackPackageExecutables = GetOption("CPACK_PACKAGE_EXECUTABLES");
+ cmProp cpackPackageExecutables = GetOption("CPACK_PACKAGE_EXECUTABLES");
if (cpackPackageExecutables) {
cmExpandList(cpackPackageExecutables, cpackPackageExecutablesList);
if (cpackPackageExecutablesList.size() % 2 != 0) {
@@ -683,8 +683,7 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
}
std::vector<std::string> cpackPackageDesktopLinksList;
- const char* cpackPackageDesktopLinks =
- GetOption("CPACK_CREATE_DESKTOP_LINKS");
+ cmProp cpackPackageDesktopLinks = GetOption("CPACK_CREATE_DESKTOP_LINKS");
if (cpackPackageDesktopLinks) {
cmExpandList(cpackPackageDesktopLinks, cpackPackageDesktopLinksList);
}
@@ -743,10 +742,9 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
std::string directoryId;
switch (type) {
case cmWIXShortcuts::START_MENU: {
- const char* cpackWixProgramMenuFolder =
+ cmProp cpackWixProgramMenuFolder =
GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER");
- if (cpackWixProgramMenuFolder &&
- cm::string_view(cpackWixProgramMenuFolder) == ".") {
+ if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder == ".") {
directoryId = "ProgramMenuFolder";
} else {
directoryId = "PROGRAM_MENU_FOLDER";
@@ -805,10 +803,9 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
fileDefinitions);
if (type == cmWIXShortcuts::START_MENU) {
- const char* cpackWixProgramMenuFolder =
+ cmProp cpackWixProgramMenuFolder =
GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER");
- if (cpackWixProgramMenuFolder &&
- cm::string_view(cpackWixProgramMenuFolder) != ".") {
+ if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder != ".") {
fileDefinitions.EmitRemoveFolder("CM_REMOVE_PROGRAM_MENU_FOLDER" +
idSuffix);
}
@@ -973,9 +970,9 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions(
bool cmCPackWIXGenerator::RequireOption(std::string const& name,
std::string& value) const
{
- const char* tmp = GetOption(name.c_str());
+ cmProp tmp = GetOption(name);
if (tmp) {
- value = tmp;
+ value = *tmp;
return true;
} else {
@@ -1146,7 +1143,7 @@ bool cmCPackWIXGenerator::IsLegalIdCharacter(char c)
void cmCPackWIXGenerator::CollectExtensions(std::string const& variableName,
extension_set_t& extensions)
{
- const char* variableContent = GetOption(variableName.c_str());
+ cmProp variableContent = GetOption(variableName);
if (!variableContent)
return;
@@ -1157,7 +1154,7 @@ void cmCPackWIXGenerator::CollectExtensions(std::string const& variableName,
void cmCPackWIXGenerator::CollectXmlNamespaces(std::string const& variableName,
xmlns_map_t& namespaces)
{
- const char* variableContent = GetOption(variableName.c_str());
+ cmProp variableContent = GetOption(variableName);
if (!variableContent) {
return;
}
@@ -1186,7 +1183,7 @@ void cmCPackWIXGenerator::CollectXmlNamespaces(std::string const& variableName,
void cmCPackWIXGenerator::AddCustomFlags(std::string const& variableName,
std::ostream& stream)
{
- const char* variableContent = GetOption(variableName.c_str());
+ cmProp variableContent = GetOption(variableName);
if (!variableContent)
return;