CPackWIX.cmake 9.8 KB

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