CPack/WIX: Improve formatting of CPACK_WIX_CUSTOM_XMLNS expansion

This commit is contained in:
Brad King
2024-03-19 14:05:55 -04:00
parent 54d09a2b3f
commit ac25c645a7
2 changed files with 6 additions and 11 deletions

View File

@@ -2,7 +2,7 @@
<?include "cpack_variables.wxi"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" @CPACK_WIX_CUSTOM_XMLNS_EXPANDED@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"@CPACK_WIX_CUSTOM_XMLNS_EXPANDED@
RequiredVersion="3.6.3303.0">
<Product Id="$(var.CPACK_WIX_PRODUCT_GUID)"

View File

@@ -1184,12 +1184,7 @@ void cmCPackWIXGenerator::CollectExtensions(std::string const& variableName,
void cmCPackWIXGenerator::CollectXmlNamespaces(std::string const& variableName,
xmlns_map_t& namespaces)
{
cmValue variableContent = GetOption(variableName);
if (!variableContent) {
return;
}
cmList list{ variableContent };
cmList list{ GetOption(variableName) };
for (std::string const& str : list) {
auto pos = str.find('=');
if (pos != std::string::npos) {
@@ -1203,12 +1198,12 @@ void cmCPackWIXGenerator::CollectXmlNamespaces(std::string const& variableName,
<< str << '"' << std::endl);
}
}
std::ostringstream oss;
std::string xmlns;
for (auto& ns : namespaces) {
oss << " xmlns:" << ns.first << "=\""
<< cmWIXSourceWriter::EscapeAttributeValue(ns.second) << '"';
xmlns = cmStrCat(xmlns, "\n xmlns:", ns.first, "=\"",
cmWIXSourceWriter::EscapeAttributeValue(ns.second), '"');
}
SetOption("CPACK_WIX_CUSTOM_XMLNS_EXPANDED", oss.str());
SetOption("CPACK_WIX_CUSTOM_XMLNS_EXPANDED", xmlns);
}
void cmCPackWIXGenerator::AddCustomFlags(std::string const& variableName,