wix.rst 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. CPack WIX Generator
  2. -------------------
  3. CPack WIX generator specific options
  4. .. versionadded:: 3.7
  5. Support :variable:`CPACK_COMPONENT_<compName>_DISABLED` variable.
  6. Variables specific to CPack WIX generator
  7. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  8. The following variables are specific to the installers built on
  9. Windows using WiX.
  10. .. variable:: CPACK_WIX_UPGRADE_GUID
  11. Upgrade GUID (``Product/@UpgradeCode``)
  12. Will be automatically generated unless explicitly provided.
  13. It should be explicitly set to a constant generated globally unique
  14. identifier (GUID) to allow your installers to replace existing
  15. installations that use the same GUID.
  16. You may for example explicitly set this variable in your
  17. CMakeLists.txt to the value that has been generated per default. You
  18. should not use GUIDs that you did not generate yourself or which may
  19. belong to other projects.
  20. A GUID shall have the following fixed length syntax::
  21. XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  22. (each X represents an uppercase hexadecimal digit)
  23. .. variable:: CPACK_WIX_PRODUCT_GUID
  24. Product GUID (``Product/@Id``)
  25. Will be automatically generated unless explicitly provided.
  26. If explicitly provided this will set the Product Id of your installer.
  27. The installer will abort if it detects a pre-existing installation that
  28. uses the same GUID.
  29. The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID.
  30. .. variable:: CPACK_WIX_LICENSE_RTF
  31. RTF License File
  32. If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension it is used as-is.
  33. If CPACK_RESOURCE_FILE_LICENSE has an .txt extension it is implicitly
  34. converted to RTF by the WIX Generator.
  35. The expected encoding of the .txt file is UTF-8.
  36. With CPACK_WIX_LICENSE_RTF you can override the license file used by the
  37. WIX Generator in case CPACK_RESOURCE_FILE_LICENSE is in an unsupported
  38. format or the .txt -> .rtf conversion does not work as expected.
  39. .. variable:: CPACK_WIX_PRODUCT_ICON
  40. The Icon shown next to the program name in Add/Remove programs.
  41. If set, this icon is used in place of the default icon.
  42. .. variable:: CPACK_WIX_UI_REF
  43. This variable allows you to override the Id of the ``<UIRef>`` element
  44. in the WiX template.
  45. The default is ``WixUI_InstallDir`` in case no CPack components have
  46. been defined and ``WixUI_FeatureTree`` otherwise.
  47. .. variable:: CPACK_WIX_UI_BANNER
  48. The bitmap will appear at the top of all installer pages other than the
  49. welcome and completion dialogs.
  50. If set, this image will replace the default banner image.
  51. This image must be 493 by 58 pixels.
  52. .. variable:: CPACK_WIX_UI_DIALOG
  53. Background bitmap used on the welcome and completion dialogs.
  54. If this variable is set, the installer will replace the default dialog
  55. image.
  56. This image must be 493 by 312 pixels.
  57. .. variable:: CPACK_WIX_PROGRAM_MENU_FOLDER
  58. Start menu folder name for launcher.
  59. If this variable is not set, it will be initialized with CPACK_PACKAGE_NAME
  60. .. versionadded:: 3.16
  61. If this variable is set to ``.``, then application shortcuts will be
  62. created directly in the start menu and the uninstaller shortcut will be
  63. omitted.
  64. .. variable:: CPACK_WIX_CULTURES
  65. Language(s) of the installer
  66. Languages are compiled into the WixUI extension library. To use them,
  67. simply provide the name of the culture. If you specify more than one
  68. culture identifier in a comma or semicolon delimited list, the first one
  69. that is found will be used. You can find a list of supported languages at:
  70. http://wix.sourceforge.net/manual-wix3/WixUI_localization.htm
  71. .. variable:: CPACK_WIX_TEMPLATE
  72. Template file for WiX generation
  73. If this variable is set, the specified template will be used to generate
  74. the WiX wxs file. This should be used if further customization of the
  75. output is required.
  76. If this variable is not set, the default MSI template included with CMake
  77. will be used.
  78. .. variable:: CPACK_WIX_PATCH_FILE
  79. Optional list of XML files with fragments to be inserted into
  80. generated WiX sources.
  81. .. versionadded:: 3.5
  82. Support listing multiple patch files.
  83. This optional variable can be used to specify an XML file that the
  84. WIX generator will use to inject fragments into its generated
  85. source files.
  86. Patch files understood by the CPack WIX generator
  87. roughly follow this RELAX NG compact schema:
  88. .. code-block:: none
  89. start = CPackWiXPatch
  90. CPackWiXPatch = element CPackWiXPatch { CPackWiXFragment* }
  91. CPackWiXFragment = element CPackWiXFragment
  92. {
  93. attribute Id { string },
  94. fragmentContent*
  95. }
  96. fragmentContent = element * - CPackWiXFragment
  97. {
  98. (attribute * { text } | text | fragmentContent)*
  99. }
  100. Currently fragments can be injected into most
  101. Component, File, Directory and Feature elements.
  102. .. versionadded:: 3.3
  103. The following additional special Ids can be used:
  104. * ``#PRODUCT`` for the ``<Product>`` element.
  105. * ``#PRODUCTFEATURE`` for the root ``<Feature>`` element.
  106. .. versionadded:: 3.7
  107. Support patching arbitrary ``<Feature>`` elements.
  108. .. versionadded:: 3.9
  109. Allow setting additional attributes.
  110. The following example illustrates how this works.
  111. Given that the WIX generator creates the following XML element:
  112. .. code-block:: xml
  113. <Component Id="CM_CP_applications.bin.my_libapp.exe" Guid="*"/>
  114. The following XML patch file may be used to inject an Environment element
  115. into it:
  116. .. code-block:: xml
  117. <CPackWiXPatch>
  118. <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe">
  119. <Environment Id="MyEnvironment" Action="set"
  120. Name="MyVariableName" Value="MyVariableValue"/>
  121. </CPackWiXFragment>
  122. </CPackWiXPatch>
  123. .. variable:: CPACK_WIX_EXTRA_SOURCES
  124. Extra WiX source files
  125. This variable provides an optional list of extra WiX source files (.wxs)
  126. that should be compiled and linked. The full path to source files is
  127. required.
  128. .. variable:: CPACK_WIX_EXTRA_OBJECTS
  129. Extra WiX object files or libraries
  130. This variable provides an optional list of extra WiX object (.wixobj)
  131. and/or WiX library (.wixlib) files. The full path to objects and libraries
  132. is required.
  133. .. variable:: CPACK_WIX_EXTENSIONS
  134. This variable provides a list of additional extensions for the WiX
  135. tools light and candle.
  136. .. variable:: CPACK_WIX_<TOOL>_EXTENSIONS
  137. This is the tool specific version of CPACK_WIX_EXTENSIONS.
  138. ``<TOOL>`` can be either LIGHT or CANDLE.
  139. .. variable:: CPACK_WIX_<TOOL>_EXTRA_FLAGS
  140. This list variable allows you to pass additional
  141. flags to the WiX tool ``<TOOL>``.
  142. Use it at your own risk.
  143. Future versions of CPack may generate flags which may be in conflict
  144. with your own flags.
  145. ``<TOOL>`` can be either LIGHT or CANDLE.
  146. .. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY
  147. If this variable is set the generated installer will create
  148. an entry in the windows registry key
  149. ``HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<PackageName>``
  150. The value for ``<PackageName>`` is provided by this variable.
  151. Assuming you also install a CMake configuration file this will
  152. allow other CMake projects to find your package with
  153. the :command:`find_package` command.
  154. .. variable:: CPACK_WIX_PROPERTY_<PROPERTY>
  155. .. versionadded:: 3.1
  156. This variable can be used to provide a value for
  157. the Windows Installer property ``<PROPERTY>``
  158. The following list contains some example properties that can be used to
  159. customize information under
  160. "Programs and Features" (also known as "Add or Remove Programs")
  161. * ARPCOMMENTS - Comments
  162. * ARPHELPLINK - Help and support information URL
  163. * ARPURLINFOABOUT - General information URL
  164. * ARPURLUPDATEINFO - Update information URL
  165. * ARPHELPTELEPHONE - Help and support telephone number
  166. * ARPSIZE - Size (in kilobytes) of the application
  167. .. variable:: CPACK_WIX_ROOT_FEATURE_TITLE
  168. .. versionadded:: 3.7
  169. Sets the name of the root install feature in the WIX installer. Same as
  170. CPACK_COMPONENT_<compName>_DISPLAY_NAME for components.
  171. .. variable:: CPACK_WIX_ROOT_FEATURE_DESCRIPTION
  172. .. versionadded:: 3.7
  173. Sets the description of the root install feature in the WIX installer. Same as
  174. CPACK_COMPONENT_<compName>_DESCRIPTION for components.
  175. .. variable:: CPACK_WIX_SKIP_PROGRAM_FOLDER
  176. .. versionadded:: 3.7
  177. If this variable is set to true, the default install location
  178. of the generated package will be CPACK_PACKAGE_INSTALL_DIRECTORY directly.
  179. The install location will not be located relatively below
  180. ProgramFiles or ProgramFiles64.
  181. .. note::
  182. Installers created with this feature do not take differences
  183. between the system on which the installer is created
  184. and the system on which the installer might be used into account.
  185. It is therefore possible that the installer e.g. might try to install
  186. onto a drive that is unavailable or unintended or a path that does not
  187. follow the localization or convention of the system on which the
  188. installation is performed.
  189. .. variable:: CPACK_WIX_ROOT_FOLDER_ID
  190. .. versionadded:: 3.9
  191. This variable allows specification of a custom root folder ID.
  192. The generator specific ``<64>`` token can be used for
  193. folder IDs that come in 32-bit and 64-bit variants.
  194. In 32-bit builds the token will expand empty while in 64-bit builds
  195. it will expand to ``64``.
  196. When unset generated installers will default installing to
  197. ``ProgramFiles<64>Folder``.
  198. .. variable:: CPACK_WIX_ROOT
  199. This variable can optionally be set to the root directory
  200. of a custom WiX Toolset installation.
  201. When unspecified CPack will try to locate a WiX Toolset
  202. installation via the ``WIX`` environment variable instead.
  203. .. variable:: CPACK_WIX_CUSTOM_XMLNS
  204. .. versionadded:: 3.19
  205. This variable provides a list of custom namespace declarations that are necessary
  206. for using WiX extensions. Each declaration should be in the form name=url, where
  207. name is the plain namespace without the usual xmlns: prefix and url is an unquoted
  208. namespace url. A list of commonly known WiX schemata can be found here:
  209. https://wixtoolset.org/documentation/manual/v3/xsd/