1 CPack productbuild Generator
2 ----------------------------
6 productbuild CPack generator (macOS).
8 Variables specific to CPack productbuild generator
9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 The following variable is specific to installers built on Mac
12 macOS using ProductBuild:
14 .. variable:: CPACK_COMMAND_PRODUCTBUILD
16 Path to the ``productbuild(1)`` command used to generate a product archive for
17 the macOS Installer or Mac App Store. This variable can be used to override
18 the automatically detected command (or specify its location if the
19 auto-detection fails to find it).
21 .. variable:: CPACK_PRODUCTBUILD_IDENTIFIER
23 .. versionadded:: 3.23
25 Set the unique (non-localized) product identifier to be associated with the
26 product (i.e., ``com.kitware.cmake``). Any component product names will be
27 appended to this value.
29 .. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME
33 Adds a digital signature to the resulting package.
36 .. variable:: CPACK_PRODUCTBUILD_KEYCHAIN_PATH
40 Specify a specific keychain to search for the signing identity.
43 .. variable:: CPACK_COMMAND_PKGBUILD
45 Path to the ``pkgbuild(1)`` command used to generate an macOS component package
46 on macOS. This variable can be used to override the automatically detected
47 command (or specify its location if the auto-detection fails to find it).
50 .. variable:: CPACK_PKGBUILD_IDENTITY_NAME
54 Adds a digital signature to the resulting package.
57 .. variable:: CPACK_PKGBUILD_KEYCHAIN_PATH
61 Specify a specific keychain to search for the signing identity.
64 .. variable:: CPACK_PREFLIGHT_<COMP>_SCRIPT
66 Full path to a file that will be used as the ``preinstall`` script for the
67 named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased
68 component name. No ``preinstall`` script is added if this variable is not
69 defined for a given component.
72 .. variable:: CPACK_POSTFLIGHT_<COMP>_SCRIPT
74 Full path to a file that will be used as the ``postinstall`` script for the
75 named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased
76 component name. No ``postinstall`` script is added if this variable is not
77 defined for a given component.
79 .. variable:: CPACK_PRODUCTBUILD_RESOURCES_DIR
83 If specified the productbuild generator copies files from this directory
84 (including subdirectories) to the ``Resources`` directory. This is done
85 before the :variable:`CPACK_RESOURCE_FILE_WELCOME`,
86 :variable:`CPACK_RESOURCE_FILE_README`, and
87 :variable:`CPACK_RESOURCE_FILE_LICENSE` files are copied.
89 .. variable:: CPACK_PRODUCTBUILD_DOMAINS
91 .. versionadded:: 3.23
93 This option enables more granular control over where the product may be
94 installed. When it is set to true, a ``domains`` element of the following
95 form will be added to the productbuild Distribution XML:
99 <domains enable_anywhere="true" enable_currentUserHome="false" enable_localSystem="true"/>
101 The default values are as shown above, but can be overridden with
102 :variable:`CPACK_PRODUCTBUILD_DOMAINS_ANYWHERE`,
103 :variable:`CPACK_PRODUCTBUILD_DOMAINS_USER`, and
104 :variable:`CPACK_PRODUCTBUILD_DOMAINS_ROOT`.
106 .. variable:: CPACK_PRODUCTBUILD_DOMAINS_ANYWHERE
108 .. versionadded:: 3.23
110 May be used to override the ``enable_anywhere`` attribute in the ``domains``
111 element of the Distribution XML. When set to true, the product can be
112 installed at the root of any volume, including non-system volumes.
114 :variable:`CPACK_PRODUCTBUILD_DOMAINS` must be set to true for this variable
117 .. variable:: CPACK_PRODUCTBUILD_DOMAINS_USER
119 .. versionadded:: 3.23
121 May be used to override the ``enable_currentUserHome`` attribute in the
122 ``domains`` element of the Distribution XML. When set to true, the product
123 can be installed into the current user's home directory. Note that when
124 installing into the user's home directory, the following additional
125 requirements will apply:
127 * The installer may not write outside the user's home directory.
128 * The install will be performed as the current user rather than as ``root``.
129 This may have ramifications for :variable:`CPACK_PREFLIGHT_<COMP>_SCRIPT`
130 and :variable:`CPACK_POSTFLIGHT_<COMP>_SCRIPT`.
131 * Administrative privileges will not be needed to perform the install.
133 :variable:`CPACK_PRODUCTBUILD_DOMAINS` must be set to true for this variable
136 .. variable:: CPACK_PRODUCTBUILD_DOMAINS_ROOT
138 .. versionadded:: 3.23
140 May be used to override the ``enable_localSystem`` attribute in the
141 ``domains`` element of the Distribution XML. When set to true, the product
142 can be installed in the root directory. This should normally be set to true
143 unless the product should only be installed to the user's home directory.
145 :variable:`CPACK_PRODUCTBUILD_DOMAINS` must be set to true for this variable
151 .. versionadded:: 3.17
153 This group of variables controls the background image of the generated
156 .. variable:: CPACK_PRODUCTBUILD_BACKGROUND
158 Adds a background to Distribution XML if specified. The value contains the
159 path to image in ``Resources`` directory.
161 .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT
163 Adds an ``alignment`` attribute to the background in Distribution XML.
164 Refer to Apple documentation for valid values.
166 .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_SCALING
168 Adds a ``scaling`` attribute to the background in Distribution XML.
169 Refer to Apple documentation for valid values.
171 .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE
173 Adds a ``mime-type`` attribute to the background in Distribution XML.
174 The option contains MIME type of an image.
176 .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_UTI
178 Adds an ``uti`` attribute to the background in Distribution XML.
179 The option contains UTI type of an image.
181 .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA
183 Adds a background for the Dark Aqua theme to Distribution XML if
184 specified. The value contains the path to image in ``Resources``
187 .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_ALIGNMENT
189 Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT` option,
190 but for the dark theme.
192 .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_SCALING
194 Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_SCALING` option,
195 but for the dark theme.
197 .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_MIME_TYPE
199 Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE` option,
200 but for the dark theme.
202 .. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_UTI
204 Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_UTI` option,
205 but for the dark theme.
207 Distribution XML Template
208 ^^^^^^^^^^^^^^^^^^^^^^^^^
210 CPack uses a template file to generate the ``distribution.dist`` file used
211 internally by this package generator. Ordinarily, CMake provides the template
212 file, but projects may supply their own by placing a file called
213 ``CPack.distribution.dist.in`` in one of the directories listed in the
214 :variable:`CMAKE_MODULE_PATH` variable. CPack will then pick up the project's
215 template file instead of using its own.
217 The ``distribution.dist`` file is generated by performing substitutions
218 similar to the :command:`configure_file` command. Any variable set when
219 CPack runs will be available for substitution using the usual ``@...@``
220 form. The following variables are also set internally and made available for
223 ``CPACK_RESOURCE_FILE_LICENSE_NOPATH``
224 Same as :variable:`CPACK_RESOURCE_FILE_LICENSE` except without the path.
225 The named file will be available in the same directory as the generated
226 ``distribution.dist`` file.
228 ``CPACK_RESOURCE_FILE_README_NOPATH``
229 Same as :variable:`CPACK_RESOURCE_FILE_README` except without the path.
230 The named file will be available in the same directory as the generated
231 ``distribution.dist`` file.
233 ``CPACK_RESOURCE_FILE_WELCOME_NOPATH``
234 Same as :variable:`CPACK_RESOURCE_FILE_WELCOME` except without the path.
235 The named file will be available in the same directory as the generated
236 ``distribution.dist`` file.
238 ``CPACK_APPLE_PKG_INSTALLER_CONTENT``
239 .. versionadded:: 3.23
241 This contains all the XML elements that specify installer-wide options
242 (including domain details), default backgrounds and the choices outline.
244 ``CPACK_PACKAGEMAKER_CHOICES``
247 This contains only the XML elements that specify the default backgrounds
248 and the choices outline. It does not include the installer-wide options or
249 any domain details. Use ``CPACK_APPLE_PKG_INSTALLER_CONTENT`` instead.