diff options
author | Keith Holman <keith.holman@windriver.com> | 2017-04-21 14:42:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-04-24 14:06:45 (GMT) |
commit | 58cf9d417e8b3d4d76597b9950a5af4860d3512c (patch) | |
tree | 08aeb2a3bdf95f4d1af0c27efcbee4f0f9d49637 /Source/CPack/WiX/cmWIXPatchParser.cxx | |
parent | 03628bb699956d92676c610e9a24d159aa591900 (diff) | |
download | CMake-58cf9d417e8b3d4d76597b9950a5af4860d3512c.zip CMake-58cf9d417e8b3d4d76597b9950a5af4860d3512c.tar.gz CMake-58cf9d417e8b3d4d76597b9950a5af4860d3512c.tar.bz2 |
wix: adds ability to modify attributes with patch
Adds the ability to attributes to generated XML files for features with
the WiX patch system. To modify attributes additional attributes may be
added within the 'CPackWixFragment' xml tag.
Fixes: #16813
Signed-off-by: Keith Holman <keith.holman@windriver.com>
Diffstat (limited to 'Source/CPack/WiX/cmWIXPatchParser.cxx')
-rw-r--r-- | Source/CPack/WiX/cmWIXPatchParser.cxx | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index 7f2ae19..0dcc74a 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -72,9 +72,11 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char** atts) void cmWIXPatchParser::StartFragment(const char** attributes) { + cmWIXPatchElement* new_element = CM_NULLPTR; + /* find the id of for fragment */ for (size_t i = 0; attributes[i]; i += 2) { - std::string key = attributes[i]; - std::string value = attributes[i + 1]; + const std::string key = attributes[i]; + const std::string value = attributes[i + 1]; if (key == "Id") { if (Fragments.find(value) != Fragments.end()) { @@ -83,10 +85,22 @@ void cmWIXPatchParser::StartFragment(const char** attributes) ReportValidationError(tmp.str()); } - ElementStack.push_back(&Fragments[value]); - } else { - ReportValidationError( - "The only allowed 'CPackWixFragment' attribute is 'Id'"); + new_element = &Fragments[value]; + ElementStack.push_back(new_element); + } + } + + /* add any additional attributes for the fragement */ + if (!new_element) { + ReportValidationError("No 'Id' specified for 'CPackWixFragment' element"); + } else { + for (size_t i = 0; attributes[i]; i += 2) { + const std::string key = attributes[i]; + const std::string value = attributes[i + 1]; + + if (key != "Id") { + new_element->attributes[key] = value; + } } } } |