CPackWIX: Add support for custom WiX templates

WiX provides a lot of functionality for installers that cannot be
supported (easily) in the default WIX.template.in file.

For most users, the default template should be fine.  However if users
want to produce merge modules, include custom actions, etc, this new
option allows for a hook into how the wxs is produced.
This commit is contained in:
Adam J. Weigold 2013-07-02 17:19:31 -05:00 committed by Brad King
parent 155bb01bd5
commit bf23891942
2 changed files with 13 additions and 0 deletions

View File

@ -93,6 +93,15 @@
# http://wix.sourceforge.net/manual-wix3/WixUI_localization.htm # http://wix.sourceforge.net/manual-wix3/WixUI_localization.htm
# #
##end ##end
##variable
# CPACK_WIX_TEMPLATE - Template file for WiX generation
#
# If this variable is set, the specified template will be used to generate the WiX wxs file.
# This should be used if further customization of the output is required.
#
# If this variable is not set, the default MSI template included with CMake will be used.
#
##end
#============================================================================= #=============================================================================
# Copyright 2012 Kitware, Inc. # Copyright 2012 Kitware, Inc.

View File

@ -451,6 +451,10 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
directoryDefinitions.EndElement(); directoryDefinitions.EndElement();
std::string wixTemplate = FindTemplate("WIX.template.in"); std::string wixTemplate = FindTemplate("WIX.template.in");
if(GetOption("CPACK_WIX_TEMPLATE") != 0)
{
wixTemplate = GetOption("CPACK_WIX_TEMPLATE");
}
if(wixTemplate.empty()) if(wixTemplate.empty())
{ {
cmCPackLogger(cmCPackLog::LOG_ERROR, cmCPackLogger(cmCPackLog::LOG_ERROR,