productbuild.rst 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. CPack productbuild Generator
  2. ----------------------------
  3. .. versionadded:: 3.7
  4. productbuild CPack generator (macOS).
  5. Variables specific to CPack productbuild generator
  6. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  7. The following variable is specific to installers built on Mac
  8. macOS using ProductBuild:
  9. .. variable:: CPACK_COMMAND_PRODUCTBUILD
  10. Path to the ``productbuild(1)`` command used to generate a product archive for
  11. the macOS Installer or Mac App Store. This variable can be used to override
  12. the automatically detected command (or specify its location if the
  13. auto-detection fails to find it).
  14. .. variable:: CPACK_PRODUCTBUILD_IDENTIFIER
  15. .. versionadded:: 3.23
  16. Set the unique (non-localized) product identifier to be associated with the
  17. product (i.e., ``com.kitware.cmake``). Any component product names will be
  18. appended to this value.
  19. .. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME
  20. .. versionadded:: 3.8
  21. Adds a digital signature to the resulting package.
  22. .. variable:: CPACK_PRODUCTBUILD_KEYCHAIN_PATH
  23. .. versionadded:: 3.8
  24. Specify a specific keychain to search for the signing identity.
  25. .. variable:: CPACK_COMMAND_PKGBUILD
  26. Path to the ``pkgbuild(1)`` command used to generate an macOS component package
  27. on macOS. This variable can be used to override the automatically detected
  28. command (or specify its location if the auto-detection fails to find it).
  29. .. variable:: CPACK_PKGBUILD_IDENTITY_NAME
  30. .. versionadded:: 3.8
  31. Adds a digital signature to the resulting package.
  32. .. variable:: CPACK_PKGBUILD_KEYCHAIN_PATH
  33. .. versionadded:: 3.8
  34. Specify a specific keychain to search for the signing identity.
  35. .. variable:: CPACK_PREFLIGHT_<COMP>_SCRIPT
  36. Full path to a file that will be used as the ``preinstall`` script for the
  37. named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased
  38. component name. No ``preinstall`` script is added if this variable is not
  39. defined for a given component.
  40. .. variable:: CPACK_POSTFLIGHT_<COMP>_SCRIPT
  41. Full path to a file that will be used as the ``postinstall`` script for the
  42. named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased
  43. component name. No ``postinstall`` script is added if this variable is not
  44. defined for a given component.
  45. .. variable:: CPACK_PRODUCTBUILD_RESOURCES_DIR
  46. .. versionadded:: 3.9
  47. If specified the productbuild generator copies files from this directory
  48. (including subdirectories) to the ``Resources`` directory. This is done
  49. before the :variable:`CPACK_RESOURCE_FILE_WELCOME`,
  50. :variable:`CPACK_RESOURCE_FILE_README`, and
  51. :variable:`CPACK_RESOURCE_FILE_LICENSE` files are copied.
  52. .. variable:: CPACK_PRODUCTBUILD_DOMAINS
  53. .. versionadded:: 3.23
  54. This option enables more granular control over where the product may be
  55. installed. When it is set to true (see policy :policy:`CMP0161`), a
  56. ``domains`` element of the following form will be added to the
  57. productbuild Distribution XML:
  58. .. code-block:: xml
  59. <domains enable_anywhere="true" enable_currentUserHome="false" enable_localSystem="true"/>
  60. The default values are as shown above, but can be overridden with
  61. :variable:`CPACK_PRODUCTBUILD_DOMAINS_ANYWHERE`,
  62. :variable:`CPACK_PRODUCTBUILD_DOMAINS_USER`, and
  63. :variable:`CPACK_PRODUCTBUILD_DOMAINS_ROOT`.
  64. .. variable:: CPACK_PRODUCTBUILD_DOMAINS_ANYWHERE
  65. .. versionadded:: 3.23
  66. May be used to override the ``enable_anywhere`` attribute in the ``domains``
  67. element of the Distribution XML. When set to true, the product can be
  68. installed at the root of any volume, including non-system volumes.
  69. :variable:`CPACK_PRODUCTBUILD_DOMAINS` must be set to true for this variable
  70. to have any effect.
  71. .. variable:: CPACK_PRODUCTBUILD_DOMAINS_USER
  72. .. versionadded:: 3.23
  73. May be used to override the ``enable_currentUserHome`` attribute in the
  74. ``domains`` element of the Distribution XML. When set to true, the product
  75. can be installed into the current user's home directory. Note that when
  76. installing into the user's home directory, the following additional
  77. requirements will apply:
  78. * The installer may not write outside the user's home directory.
  79. * The install will be performed as the current user rather than as ``root``.
  80. This may have ramifications for :variable:`CPACK_PREFLIGHT_<COMP>_SCRIPT`
  81. and :variable:`CPACK_POSTFLIGHT_<COMP>_SCRIPT`.
  82. * Administrative privileges will not be needed to perform the install.
  83. :variable:`CPACK_PRODUCTBUILD_DOMAINS` must be set to true for this variable
  84. to have any effect.
  85. .. variable:: CPACK_PRODUCTBUILD_DOMAINS_ROOT
  86. .. versionadded:: 3.23
  87. May be used to override the ``enable_localSystem`` attribute in the
  88. ``domains`` element of the Distribution XML. When set to true, the product
  89. can be installed in the root directory. This should normally be set to true
  90. unless the product should only be installed to the user's home directory.
  91. :variable:`CPACK_PRODUCTBUILD_DOMAINS` must be set to true for this variable
  92. to have any effect.
  93. Background Image
  94. """"""""""""""""
  95. .. versionadded:: 3.17
  96. This group of variables controls the background image of the generated
  97. installer.
  98. .. variable:: CPACK_PRODUCTBUILD_BACKGROUND
  99. Adds a background to Distribution XML if specified. The value contains the
  100. path to image in ``Resources`` directory.
  101. .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT
  102. Adds an ``alignment`` attribute to the background in Distribution XML.
  103. Refer to Apple documentation for valid values.
  104. .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_SCALING
  105. Adds a ``scaling`` attribute to the background in Distribution XML.
  106. Refer to Apple documentation for valid values.
  107. .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE
  108. Adds a ``mime-type`` attribute to the background in Distribution XML.
  109. The option contains MIME type of an image.
  110. .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_UTI
  111. Adds an ``uti`` attribute to the background in Distribution XML.
  112. The option contains UTI type of an image.
  113. .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA
  114. Adds a background for the Dark Aqua theme to Distribution XML if
  115. specified. The value contains the path to image in ``Resources``
  116. directory.
  117. .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_ALIGNMENT
  118. Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT` option,
  119. but for the dark theme.
  120. .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_SCALING
  121. Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_SCALING` option,
  122. but for the dark theme.
  123. .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_MIME_TYPE
  124. Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE` option,
  125. but for the dark theme.
  126. .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_UTI
  127. Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_UTI` option,
  128. but for the dark theme.
  129. Distribution XML Template
  130. ^^^^^^^^^^^^^^^^^^^^^^^^^
  131. CPack uses a template file to generate the ``distribution.dist`` file used
  132. internally by this package generator. Ordinarily, CMake provides the template
  133. file, but projects may supply their own by placing a file called
  134. ``CPack.distribution.dist.in`` in one of the directories listed in the
  135. :variable:`CMAKE_MODULE_PATH` variable. CPack will then pick up the project's
  136. template file instead of using its own.
  137. The ``distribution.dist`` file is generated by performing substitutions
  138. similar to the :command:`configure_file` command. Any variable set when
  139. CPack runs will be available for substitution using the usual ``@...@``
  140. form. The following variables are also set internally and made available for
  141. substitution:
  142. ``CPACK_RESOURCE_FILE_LICENSE_NOPATH``
  143. Same as :variable:`CPACK_RESOURCE_FILE_LICENSE` except without the path.
  144. The named file will be available in the same directory as the generated
  145. ``distribution.dist`` file.
  146. ``CPACK_RESOURCE_FILE_README_NOPATH``
  147. Same as :variable:`CPACK_RESOURCE_FILE_README` except without the path.
  148. The named file will be available in the same directory as the generated
  149. ``distribution.dist`` file.
  150. ``CPACK_RESOURCE_FILE_WELCOME_NOPATH``
  151. Same as :variable:`CPACK_RESOURCE_FILE_WELCOME` except without the path.
  152. The named file will be available in the same directory as the generated
  153. ``distribution.dist`` file.
  154. ``CPACK_APPLE_PKG_INSTALLER_CONTENT``
  155. .. versionadded:: 3.23
  156. This contains all the XML elements that specify installer-wide options
  157. (including domain details), default backgrounds and the choices outline.
  158. ``CPACK_PACKAGEMAKER_CHOICES``
  159. .. deprecated:: 3.23
  160. This contains only the XML elements that specify the default backgrounds
  161. and the choices outline. It does not include the installer-wide options or
  162. any domain details. Use ``CPACK_APPLE_PKG_INSTALLER_CONTENT`` instead.