wix.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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. https://wixtoolset.org/docs/v3/wixui/wixui_localization/
  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. The template contents will override the effect of most
  76. ``CPACK_WIX_`` variables.
  77. If this variable is not set, the default MSI template included with CMake
  78. will be used.
  79. .. variable:: CPACK_WIX_PATCH_FILE
  80. Optional list of XML files with fragments to be inserted into
  81. generated WiX sources.
  82. .. versionadded:: 3.5
  83. Support listing multiple patch files.
  84. This optional variable can be used to specify an XML file that the
  85. WIX generator will use to inject fragments into its generated
  86. source files.
  87. Patch files understood by the CPack WIX generator
  88. roughly follow this RELAX NG compact schema:
  89. .. code-block:: none
  90. start = CPackWiXPatch
  91. CPackWiXPatch = element CPackWiXPatch { CPackWiXFragment* }
  92. CPackWiXFragment = element CPackWiXFragment
  93. {
  94. attribute Id { string },
  95. fragmentContent*
  96. }
  97. fragmentContent = element * - CPackWiXFragment
  98. {
  99. (attribute * { text } | text | fragmentContent)*
  100. }
  101. Currently fragments can be injected into most
  102. Component, File, Directory and Feature elements.
  103. .. versionadded:: 3.3
  104. The following additional special Ids can be used:
  105. * ``#PRODUCT`` for the ``<Product>`` element.
  106. * ``#PRODUCTFEATURE`` for the root ``<Feature>`` element.
  107. .. versionadded:: 3.7
  108. Support patching arbitrary ``<Feature>`` elements.
  109. .. versionadded:: 3.9
  110. Allow setting additional attributes.
  111. The following example illustrates how this works.
  112. Given that the WIX generator creates the following XML element:
  113. .. code-block:: xml
  114. <Component Id="CM_CP_applications.bin.my_libapp.exe" Guid="*"/>
  115. The following XML patch file may be used to inject an Environment element
  116. into it:
  117. .. code-block:: xml
  118. <CPackWiXPatch>
  119. <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe">
  120. <Environment Id="MyEnvironment" Action="set"
  121. Name="MyVariableName" Value="MyVariableValue"/>
  122. </CPackWiXFragment>
  123. </CPackWiXPatch>
  124. .. variable:: CPACK_WIX_EXTRA_SOURCES
  125. Extra WiX source files
  126. This variable provides an optional list of extra WiX source files (.wxs)
  127. that should be compiled and linked. The full path to source files is
  128. required.
  129. .. variable:: CPACK_WIX_EXTRA_OBJECTS
  130. Extra WiX object files or libraries
  131. This variable provides an optional list of extra WiX object (.wixobj)
  132. and/or WiX library (.wixlib) files. The full path to objects and libraries
  133. is required.
  134. .. variable:: CPACK_WIX_EXTENSIONS
  135. This variable provides a list of additional extensions for the WiX
  136. tools light and candle.
  137. .. variable:: CPACK_WIX_<TOOL>_EXTENSIONS
  138. This is the tool specific version of CPACK_WIX_EXTENSIONS.
  139. ``<TOOL>`` can be either LIGHT or CANDLE.
  140. .. variable:: CPACK_WIX_<TOOL>_EXTRA_FLAGS
  141. This list variable allows you to pass additional
  142. flags to the WiX tool ``<TOOL>``.
  143. Use it at your own risk.
  144. Future versions of CPack may generate flags which may be in conflict
  145. with your own flags.
  146. ``<TOOL>`` can be either LIGHT or CANDLE.
  147. .. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY
  148. If this variable is set the generated installer will create
  149. an entry in the windows registry key
  150. ``HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<PackageName>``
  151. The value for ``<PackageName>`` is provided by this variable.
  152. Assuming you also install a CMake configuration file this will
  153. allow other CMake projects to find your package with
  154. the :command:`find_package` command.
  155. .. variable:: CPACK_WIX_PROPERTY_<PROPERTY>
  156. .. versionadded:: 3.1
  157. This variable can be used to provide a value for
  158. the Windows Installer property ``<PROPERTY>``
  159. The following list contains some example properties that can be used to
  160. customize information under
  161. "Programs and Features" (also known as "Add or Remove Programs")
  162. * ARPCOMMENTS - Comments
  163. * ARPHELPLINK - Help and support information URL
  164. * ARPURLINFOABOUT - General information URL
  165. * ARPURLUPDATEINFO - Update information URL
  166. * ARPHELPTELEPHONE - Help and support telephone number
  167. * ARPSIZE - Size (in kilobytes) of the application
  168. .. variable:: CPACK_WIX_ROOT_FEATURE_TITLE
  169. .. versionadded:: 3.7
  170. Sets the name of the root install feature in the WIX installer. Same as
  171. CPACK_COMPONENT_<compName>_DISPLAY_NAME for components.
  172. .. variable:: CPACK_WIX_ROOT_FEATURE_DESCRIPTION
  173. .. versionadded:: 3.7
  174. Sets the description of the root install feature in the WIX installer. Same as
  175. CPACK_COMPONENT_<compName>_DESCRIPTION for components.
  176. .. variable:: CPACK_WIX_SKIP_PROGRAM_FOLDER
  177. .. versionadded:: 3.7
  178. If this variable is set to true, the default install location
  179. of the generated package will be CPACK_PACKAGE_INSTALL_DIRECTORY directly.
  180. The install location will not be located relatively below
  181. ProgramFiles or ProgramFiles64.
  182. .. note::
  183. Installers created with this feature do not take differences
  184. between the system on which the installer is created
  185. and the system on which the installer might be used into account.
  186. It is therefore possible that the installer e.g. might try to install
  187. onto a drive that is unavailable or unintended or a path that does not
  188. follow the localization or convention of the system on which the
  189. installation is performed.
  190. .. variable:: CPACK_WIX_ROOT_FOLDER_ID
  191. .. versionadded:: 3.9
  192. This variable allows specification of a custom root folder ID.
  193. The generator specific ``<64>`` token can be used for
  194. folder IDs that come in 32-bit and 64-bit variants.
  195. In 32-bit builds the token will expand empty while in 64-bit builds
  196. it will expand to ``64``.
  197. When unset generated installers will default installing to
  198. ``ProgramFiles<64>Folder``.
  199. .. variable:: CPACK_WIX_ROOT
  200. This variable can optionally be set to the root directory
  201. of a custom WiX Toolset installation.
  202. When unspecified CPack will try to locate a WiX Toolset
  203. installation via the ``WIX`` environment variable instead.
  204. .. variable:: CPACK_WIX_CUSTOM_XMLNS
  205. .. versionadded:: 3.19
  206. This variable provides a list of custom namespace declarations that are necessary
  207. for using WiX extensions. Each declaration should be in the form name=url, where
  208. name is the plain namespace without the usual xmlns: prefix and url is an unquoted
  209. namespace url. A list of commonly known WiX schemata can be found here:
  210. https://wixtoolset.org/docs/v3/xsd/
  211. .. variable:: CPACK_WIX_SKIP_WIX_UI_EXTENSION
  212. .. versionadded:: 3.23
  213. If this variable is set then the inclusion of WixUIExtensions is skipped,
  214. i.e. the ``-ext "WixUIExtension"`` command line is not included during
  215. the execution of the WiX light tool.
  216. .. variable:: CPACK_WIX_ARCHITECTURE
  217. .. versionadded:: 3.24
  218. This variable can be optionally set to specify the target architecture
  219. of the installer. May for example be set to ``x64`` or ``arm64``.
  220. When unspecified, CPack will default to ``x64`` or ``x86``.
  221. .. variable:: CPACK_WIX_INSTALL_SCOPE
  222. .. versionadded:: 3.29
  223. This variable can be optionally set to specify the ``InstallScope``
  224. of the installer:
  225. ``perMachine`` (default)
  226. Create an installer that installs for all users and requires
  227. administrative privileges. Start menu entries created by the
  228. installer are visible to all users.
  229. ``perUser``
  230. Not yet supported. This is reserved for future use.
  231. ``NONE``
  232. Create an installer without any ``InstallScope`` attribute.
  233. .. deprecated:: 3.29
  234. This value is only for compatibility with the inconsistent behavior used
  235. by CPack 3.28 and older. The resulting installer requires administrative
  236. privileges and installs into the system-wide ``ProgramFiles`` directory,
  237. but the start menu entry and uninstaller registration are created only
  238. for the current user.
  239. See https://wixtoolset.org/docs/v3/xsd/wix/package/