CPackWIX: Extend the patching mechanism to allow adding content to <Product>.

This commit is contained in:
Nils Gladitz 2015-02-13 11:57:20 +01:00
parent 8d38ff05e2
commit a2ccbffd8b
4 changed files with 21 additions and 3 deletions

View File

@ -148,6 +148,9 @@
# Currently fragments can be injected into most # Currently fragments can be injected into most
# Component, File and Directory elements. # Component, File and Directory elements.
# #
# The special Id ``#PRODUCT`` can be used to inject content
# into the ``<Product>`` element.
#
# The following example illustrates how this works. # The following example illustrates how this works.
# #
# Given that the WiX generator creates the following XML element: # Given that the WiX generator creates the following XML element:
@ -233,7 +236,7 @@
# * ARPSIZE - Size (in kilobytes) of the application # * ARPSIZE - Size (in kilobytes) of the application
#============================================================================= #=============================================================================
# Copyright 2014 Kitware, Inc. # Copyright 2014-2015 Kitware, Inc.
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.

View File

@ -42,5 +42,6 @@
<UIRef Id="$(var.CPACK_WIX_UI_REF)" /> <UIRef Id="$(var.CPACK_WIX_UI_REF)" />
<?include "properties.wxi"?> <?include "properties.wxi"?>
<?include "product_fragment.wxi"?>
</Product> </Product>
</Wix> </Wix>

View File

@ -1,6 +1,6 @@
/*============================================================================ /*============================================================================
CMake - Cross Platform Makefile Generator CMake - Cross Platform Makefile Generator
Copyright 2000-2014 Kitware, Inc., Insight Software Consortium Copyright 2012-2015 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License"); Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details. see accompanying file Copyright.txt for details.
@ -257,6 +257,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
CreateWiXVariablesIncludeFile(); CreateWiXVariablesIncludeFile();
CreateWiXPropertiesIncludeFile(); CreateWiXPropertiesIncludeFile();
CreateWiXProductFragmentIncludeFile();
if(!CreateWiXSourceFiles()) if(!CreateWiXSourceFiles())
{ {
@ -385,6 +386,17 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile()
} }
} }
void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile()
{
std::string includeFilename =
this->CPackTopLevel + "/product_fragment.wxi";
cmWIXSourceWriter includeFile(
this->Logger, includeFilename, true);
this->Patch->ApplyFragment("#PRODUCT", includeFile);
}
void cmCPackWIXGenerator::CopyDefinition( void cmCPackWIXGenerator::CopyDefinition(
cmWIXSourceWriter &source, std::string const& name) cmWIXSourceWriter &source, std::string const& name)
{ {

View File

@ -1,6 +1,6 @@
/*============================================================================ /*============================================================================
CMake - Cross Platform Makefile Generator CMake - Cross Platform Makefile Generator
Copyright 2000-2012 Kitware, Inc. Copyright 2012-2015 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License"); Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details. see accompanying file Copyright.txt for details.
@ -76,6 +76,8 @@ private:
void CreateWiXPropertiesIncludeFile(); void CreateWiXPropertiesIncludeFile();
void CreateWiXProductFragmentIncludeFile();
void CopyDefinition( void CopyDefinition(
cmWIXSourceWriter &source, std::string const& name); cmWIXSourceWriter &source, std::string const& name);