diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2015-12-14 22:04:41 (GMT) |
---|---|---|
committer | Nils Gladitz <nilsgladitz@gmail.com> | 2015-12-14 22:28:42 (GMT) |
commit | de77d4a741c84e0b5774e79a0c84e945e25ad9f8 (patch) | |
tree | ac2389115e181bbeb266f14d9f21f8537b0422ce /Source/CPack | |
parent | 38d723b37e660223a9c8a125cf01ae5a6c9977ba (diff) | |
download | CMake-de77d4a741c84e0b5774e79a0c84e945e25ad9f8.zip CMake-de77d4a741c84e0b5774e79a0c84e945e25ad9f8.tar.gz CMake-de77d4a741c84e0b5774e79a0c84e945e25ad9f8.tar.bz2 |
CPackWIX: Allow multiple patch files and diagnose if any are missing
CPACK_WIX_PATCH_FILE now accepts a list of patch files.
An error will now be produced if any of the patch files is missing.
Previously this would be silently ignored.
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXPatch.cxx | 12 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXPatch.h | 2 |
3 files changed, 21 insertions, 4 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index b55c5a5..ece327a 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -242,7 +242,16 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE"); if(patchFilePath) { - this->Patch->LoadFragments(patchFilePath); + std::vector<std::string> patchFilePaths; + cmSystemTools::ExpandListArgument(patchFilePath, patchFilePaths); + + for(size_t i = 0; i < patchFilePaths.size(); ++i) + { + if(!this->Patch->LoadFragments(patchFilePaths[i])) + { + return false; + } + } } return true; diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index 471c3a4..07375da 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -20,10 +20,18 @@ cmWIXPatch::cmWIXPatch(cmCPackLog* logger): } -void cmWIXPatch::LoadFragments(std::string const& patchFilePath) +bool cmWIXPatch::LoadFragments(std::string const& patchFilePath) { cmWIXPatchParser parser(Fragments, Logger); - parser.ParseFile(patchFilePath.c_str()); + if(!parser.ParseFile(patchFilePath.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Failed parsing XML patch file: '" << + patchFilePath << "'" << std::endl); + return false; + } + + return true; } void cmWIXPatch::ApplyFragment( diff --git a/Source/CPack/WiX/cmWIXPatch.h b/Source/CPack/WiX/cmWIXPatch.h index d53fcb4..2f31a01 100644 --- a/Source/CPack/WiX/cmWIXPatch.h +++ b/Source/CPack/WiX/cmWIXPatch.h @@ -26,7 +26,7 @@ class cmWIXPatch public: cmWIXPatch(cmCPackLog* logger); - void LoadFragments(std::string const& patchFilePath); + bool LoadFragments(std::string const& patchFilePath); void ApplyFragment(std::string const& id, cmWIXSourceWriter& writer); |