summaryrefslogtreecommitdiffstats
path: root/Help/cpack_gen/productbuild.rst
blob: 48a9b4469a7de787534ebab4b2d4b5a7e3273bb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
CPack productbuild Generator
----------------------------

.. versionadded:: 3.7

productbuild CPack generator (macOS).

Variables specific to CPack productbuild generator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The following variable is specific to installers built on Mac
macOS using ProductBuild:

.. variable:: CPACK_COMMAND_PRODUCTBUILD

 Path to the ``productbuild(1)`` command used to generate a product archive for
 the macOS Installer or Mac App Store.  This variable can be used to override
 the automatically detected command (or specify its location if the
 auto-detection fails to find it).

.. variable:: CPACK_PRODUCTBUILD_IDENTIFIER

 .. versionadded:: 3.23

 Set the unique (non-localized) product identifier to be associated with the
 product (i.e., ``com.kitware.cmake``). Any component product names will be
 appended to this value.

.. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME

 .. versionadded:: 3.8

 Adds a digital signature to the resulting package.


.. variable:: CPACK_PRODUCTBUILD_KEYCHAIN_PATH

 .. versionadded:: 3.8

 Specify a specific keychain to search for the signing identity.


.. variable:: CPACK_COMMAND_PKGBUILD

 Path to the ``pkgbuild(1)`` command used to generate an macOS component package
 on macOS.  This variable can be used to override the automatically detected
 command (or specify its location if the auto-detection fails to find it).


.. variable:: CPACK_PKGBUILD_IDENTITY_NAME

 .. versionadded:: 3.8

 Adds a digital signature to the resulting package.


.. variable:: CPACK_PKGBUILD_KEYCHAIN_PATH

 .. versionadded:: 3.8

 Specify a specific keychain to search for the signing identity.


.. variable:: CPACK_PREFLIGHT_<COMP>_SCRIPT

 Full path to a file that will be used as the ``preinstall`` script for the
 named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased
 component name.  No ``preinstall`` script is added if this variable is not
 defined for a given component.


.. variable:: CPACK_POSTFLIGHT_<COMP>_SCRIPT

 Full path to a file that will be used as the ``postinstall`` script for the
 named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased
 component name.  No ``postinstall`` script is added if this variable is not
 defined for a given component.

.. variable:: CPACK_PRODUCTBUILD_RESOURCES_DIR

 .. versionadded:: 3.9

 If specified the productbuild generator copies files from this directory
 (including subdirectories) to the ``Resources`` directory. This is done
 before the :variable:`CPACK_RESOURCE_FILE_WELCOME`,
 :variable:`CPACK_RESOURCE_FILE_README`, and
 :variable:`CPACK_RESOURCE_FILE_LICENSE` files are copied.

.. variable:: CPACK_PRODUCTBUILD_DOMAINS

 .. versionadded:: 3.23

 This option enables more granular control over where the product may be
 installed. When it is set to true, a ``domains`` element of the following
 form will be added to the productbuild Distribution XML:

 .. code-block:: xml

    <domains enable_anywhere="true" enable_currentUserHome="false" enable_localSystem="true"/>

 The default values are as shown above, but can be overridden with
 :variable:`CPACK_PRODUCTBUILD_DOMAINS_ANYWHERE`,
 :variable:`CPACK_PRODUCTBUILD_DOMAINS_USER`, and
 :variable:`CPACK_PRODUCTBUILD_DOMAINS_ROOT`.

.. variable:: CPACK_PRODUCTBUILD_DOMAINS_ANYWHERE

 .. versionadded:: 3.23

 May be used to override the ``enable_anywhere`` attribute in the ``domains``
 element of the Distribution XML. When set to true, the product can be
 installed at the root of any volume, including non-system volumes.

 :variable:`CPACK_PRODUCTBUILD_DOMAINS` must be set to true for this variable
 to have any effect.

.. variable:: CPACK_PRODUCTBUILD_DOMAINS_USER

 .. versionadded:: 3.23

 May be used to override the ``enable_currentUserHome`` attribute in the
 ``domains`` element of the Distribution XML. When set to true, the product
 can be installed into the current user's home directory. Note that when
 installing into the user's home directory, the following additional
 requirements will apply:

 * The installer may not write outside the user's home directory.
 * The install will be performed as the current user rather than as ``root``.
   This may have ramifications for :variable:`CPACK_PREFLIGHT_<COMP>_SCRIPT`
   and :variable:`CPACK_POSTFLIGHT_<COMP>_SCRIPT`.
 * Administrative privileges will not be needed to perform the install.

 :variable:`CPACK_PRODUCTBUILD_DOMAINS` must be set to true for this variable
 to have any effect.

.. variable:: CPACK_PRODUCTBUILD_DOMAINS_ROOT

 .. versionadded:: 3.23

 May be used to override the ``enable_localSystem`` attribute in the
 ``domains`` element of the Distribution XML. When set to true, the product
 can be installed in the root directory. This should normally be set to true
 unless the product should only be installed to the user's home directory.

 :variable:`CPACK_PRODUCTBUILD_DOMAINS` must be set to true for this variable
 to have any effect.

Background Image
""""""""""""""""

.. versionadded:: 3.17

This group of variables controls the background image of the generated
installer.

.. variable:: CPACK_PRODUCTBUILD_BACKGROUND

 Adds a background to Distribution XML if specified. The value contains the
 path to image in ``Resources`` directory.

.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT

 Adds an ``alignment`` attribute to the background in Distribution XML.
 Refer to Apple documentation for valid values.

.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_SCALING

 Adds a ``scaling`` attribute to the background in Distribution XML.
 Refer to Apple documentation for valid values.

.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE

 Adds a ``mime-type`` attribute to the background in Distribution XML.
 The option contains MIME type of an image.

.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_UTI

 Adds an ``uti`` attribute to the background in Distribution XML.
 The option contains UTI type of an image.

.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA

 Adds a background for the Dark Aqua theme to Distribution XML if
 specified. The value contains the path to image in ``Resources``
 directory.

.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_ALIGNMENT

 Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT` option,
 but for the dark theme.

.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_SCALING

 Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_SCALING` option,
 but for the dark theme.

.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_MIME_TYPE

 Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE` option,
 but for the dark theme.

.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_UTI

 Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_UTI` option,
 but for the dark theme.

Distribution XML Template
^^^^^^^^^^^^^^^^^^^^^^^^^

CPack uses a template file to generate the ``distribution.dist`` file used
internally by this package generator. Ordinarily, CMake provides the template
file, but projects may supply their own by placing a file called
``CPack.distribution.dist.in`` in one of the directories listed in the
:variable:`CMAKE_MODULE_PATH` variable. CPack will then pick up the project's
template file instead of using its own.

The ``distribution.dist`` file is generated by performing substitutions
similar to the :command:`configure_file` command. Any variable set when
CPack runs will be available for substitution using the usual ``@...@``
form. The following variables are also set internally and made available for
substitution:

``CPACK_RESOURCE_FILE_LICENSE_NOPATH``
  Same as :variable:`CPACK_RESOURCE_FILE_LICENSE` except without the path.
  The named file will be available in the same directory as the generated
  ``distribution.dist`` file.

``CPACK_RESOURCE_FILE_README_NOPATH``
  Same as :variable:`CPACK_RESOURCE_FILE_README` except without the path.
  The named file will be available in the same directory as the generated
  ``distribution.dist`` file.

``CPACK_RESOURCE_FILE_WELCOME_NOPATH``
  Same as :variable:`CPACK_RESOURCE_FILE_WELCOME` except without the path.
  The named file will be available in the same directory as the generated
  ``distribution.dist`` file.

``CPACK_APPLE_PKG_INSTALLER_CONTENT``
  .. versionadded:: 3.23

  This contains all the XML elements that specify installer-wide options
  (including domain details), default backgrounds and the choices outline.

``CPACK_PACKAGEMAKER_CHOICES``
  .. deprecated:: 3.23

  This contains only the XML elements that specify the default backgrounds
  and the choices outline. It does not include the installer-wide options or
  any domain details. Use ``CPACK_APPLE_PKG_INSTALLER_CONTENT`` instead.