diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2013-11-10 18:48:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-11-12 19:10:01 (GMT) |
commit | 096591b96a0fb8cac2b330bc727c96ff90fa8d97 (patch) | |
tree | a20ac4716e35fc2a9c07284d09af810ed8c352cc /Source/CPack | |
parent | 6f2ec6450429661356e7153a59b4c6cae5d5f285 (diff) | |
download | CMake-096591b96a0fb8cac2b330bc727c96ff90fa8d97.zip CMake-096591b96a0fb8cac2b330bc727c96ff90fa8d97.tar.gz CMake-096591b96a0fb8cac2b330bc727c96ff90fa8d97.tar.bz2 |
CPackWiX: Add variables for custom tool extensions and flags
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.cxx | 69 | ||||
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.h | 10 |
2 files changed, 73 insertions, 6 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 448d8d1..1d7681b 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -83,6 +83,15 @@ bool cmCPackWIXGenerator::RunCandleCommand( command << " -nologo"; command << " -arch " << GetArchitecture(); command << " -out " << QuotePath(objectFile); + + for(extension_set_t::const_iterator i = candleExtensions.begin(); + i != candleExtensions.end(); ++i) + { + command << " -ext " << QuotePath(*i); + } + + AddCustomFlags("CPACK_WIX_CANDLE_EXTRA_FLAGS", command); + command << " " << QuotePath(sourceFile); return RunWiXCommand(command.str()); @@ -100,12 +109,21 @@ bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles) command << QuotePath(executable); command << " -nologo"; command << " -out " << QuotePath(packageFileNames.at(0)); - command << " -ext WixUIExtension"; + + for(extension_set_t::const_iterator i = lightExtensions.begin(); + i != lightExtensions.end(); ++i) + { + command << " -ext " << QuotePath(*i); + } + const char* const cultures = GetOption("CPACK_WIX_CULTURES"); if(cultures) { command << " -cultures:" << cultures; } + + AddCustomFlags("CPACK_WIX_LIGHT_EXTRA_FLAGS", command); + command << " " << objectFiles; return RunWiXCommand(command.str()); @@ -172,14 +190,21 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() if(GetOption("CPACK_PACKAGE_VENDOR") == 0) { - std::string defaultVendor = "Humanity"; - SetOption("CPACK_PACKAGE_VENDOR", defaultVendor.c_str()); + std::string defaultVendor = "Humanity"; + SetOption("CPACK_PACKAGE_VENDOR", defaultVendor.c_str()); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "CPACK_PACKAGE_VENDOR implicitly set to " << defaultVendor << " . " - << std::endl); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "CPACK_PACKAGE_VENDOR implicitly set to " << defaultVendor << " . " + << std::endl); } + CollectExtensions("CPACK_WIX_EXTENSIONS", candleExtensions); + CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", candleExtensions); + + lightExtensions.insert("WixUIExtension"); + CollectExtensions("CPACK_WIX_EXTENSIONS", lightExtensions); + CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", lightExtensions); + return true; } @@ -865,3 +890,35 @@ bool cmCPackWIXGenerator::IsLegalIdCharacter(char c) (c >= 'A' && c <= 'Z') || c == '_' || c == '.'; } + +void cmCPackWIXGenerator::CollectExtensions( + const std::string& variableName, extension_set_t& extensions) +{ + const char *variableContent = GetOption(variableName.c_str()); + if(!variableContent) return; + + std::vector<std::string> list; + cmSystemTools::ExpandListArgument(variableContent, list); + + for(std::vector<std::string>::const_iterator i = list.begin(); + i != list.end(); ++i) + { + extensions.insert(*i); + } +} + +void cmCPackWIXGenerator::AddCustomFlags( + const std::string& variableName, std::ostream& stream) +{ + const char *variableContent = GetOption(variableName.c_str()); + if(!variableContent) return; + + std::vector<std::string> list; + cmSystemTools::ExpandListArgument(variableContent, list); + + for(std::vector<std::string>::const_iterator i = list.begin(); + i != list.end(); ++i) + { + stream << " " << QuotePath(*i); + } +} diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index c96ad5a..481a07d 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -63,6 +63,7 @@ private: typedef std::map<std::string, std::string> id_map_t; typedef std::map<std::string, size_t> ambiguity_map_t; typedef std::map<std::string, cmWIXShortcut> shortcut_map_t; + typedef std::set<std::string> extension_set_t; bool InitializeWiXConfiguration(); @@ -129,10 +130,19 @@ private: static bool IsLegalIdCharacter(char c); + void CollectExtensions( + const std::string& variableName, extension_set_t& extensions); + + void AddCustomFlags( + const std::string& variableName, std::ostream& stream); + std::vector<std::string> wixSources; id_map_t pathToIdMap; ambiguity_map_t idAmbiguityCounter; shortcut_map_t shortcutMap; + + extension_set_t candleExtensions; + extension_set_t lightExtensions; }; #endif |