deb.rst 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. CPack DEB Generator
  2. -------------------
  3. The built in (binary) CPack DEB generator (Unix only)
  4. Variables specific to CPack Debian (DEB) generator
  5. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  6. The CPack DEB generator may be used to create DEB package using :module:`CPack`.
  7. The CPack DEB generator is a :module:`CPack` generator thus it uses the
  8. :variable:`!CPACK_XXX` variables used by :module:`CPack`.
  9. The CPack DEB generator should work on any Linux host but it will produce
  10. better deb package when Debian specific tools ``dpkg-xxx`` are usable on
  11. the build system.
  12. The CPack DEB generator has specific features which are controlled by the
  13. specifics :variable:`!CPACK_DEBIAN_XXX` variables.
  14. :variable:`!CPACK_DEBIAN_<COMPONENT>_XXXX` variables may be used in order to have
  15. **component** specific values. Note however that ``<COMPONENT>`` refers to
  16. the **grouping name** written in upper case. It may be either a component name
  17. or a component GROUP name.
  18. Here are some CPack DEB generator wiki resources that are here for historic
  19. reasons and are no longer maintained but may still prove useful:
  20. - https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/Configuration
  21. - https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/PackageGenerators#deb-unix-only
  22. List of CPack DEB generator specific variables:
  23. .. variable:: CPACK_DEB_COMPONENT_INSTALL
  24. Enable component packaging for CPackDEB
  25. :Mandatory: No
  26. :Default: ``OFF``
  27. If enabled (``ON``) multiple packages are generated. By default a single package
  28. containing files of all components is generated.
  29. .. variable:: CPACK_DEBIAN_PACKAGE_NAME
  30. CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME
  31. Set Package control field (variable is automatically transformed to lower
  32. case).
  33. :Mandatory: Yes
  34. :Default:
  35. - :variable:`CPACK_PACKAGE_NAME` for non-component based
  36. installations
  37. - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with ``-<COMPONENT>``
  38. for component-based installations.
  39. .. versionadded:: 3.5
  40. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME` variables.
  41. See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-source
  42. .. variable:: CPACK_DEBIAN_FILE_NAME
  43. CPACK_DEBIAN_<COMPONENT>_FILE_NAME
  44. .. versionadded:: 3.6
  45. Package file name.
  46. :Mandatory: Yes
  47. :Default: ``<CPACK_PACKAGE_FILE_NAME>[-<component>].deb``
  48. This may be set to:
  49. ``DEB-DEFAULT``
  50. Tell CPack to automatically generate the package file name in deb format::
  51. <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
  52. This setting recommended as the preferred behavior, but for backward
  53. compatibility with the CPack DEB generator in CMake prior to version 3.6,
  54. this is not the default. Without this, duplicate names may occur.
  55. Duplicate files get overwritten and it is up to the packager to set
  56. the variables in a manner that will prevent such errors.
  57. ``<file-name>[.deb]``
  58. Use the given file name.
  59. .. versionchanged:: 3.29
  60. The ``.deb`` suffix will be automatically added if the file name does
  61. not end in ``.deb`` or ``.ipk``. Previously the suffix was required.
  62. ``<file-name>.ipk``
  63. .. versionadded:: 3.10
  64. Use the given file name.
  65. The ``.ipk`` suffix is used by the OPKG packaging system.
  66. .. variable:: CPACK_DEBIAN_PACKAGE_EPOCH
  67. .. versionadded:: 3.10
  68. The Debian package epoch
  69. :Mandatory: No
  70. :Default: None
  71. Optional number that should be incremented when changing versioning schemas
  72. or fixing mistakes in the version numbers of older packages.
  73. .. variable:: CPACK_DEBIAN_PACKAGE_VERSION
  74. The Debian package version
  75. :Mandatory: Yes
  76. :Default: :variable:`CPACK_PACKAGE_VERSION`
  77. This variable may contain only alphanumerics (A-Za-z0-9) and the characters
  78. . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If
  79. :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` is not set then hyphens are not
  80. allowed.
  81. .. note::
  82. For backward compatibility with CMake 3.9 and lower a failed test of this
  83. variable's content is not a hard error when both
  84. :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` and
  85. :variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables are not set. An author
  86. warning is reported instead.
  87. .. variable:: CPACK_DEBIAN_PACKAGE_RELEASE
  88. .. versionadded:: 3.6
  89. The Debian package release - Debian revision number.
  90. :Mandatory: No
  91. :Default: None
  92. This is the numbering of the DEB package itself, i.e. the version of the
  93. packaging and not the version of the content (see
  94. :variable:`CPACK_DEBIAN_PACKAGE_VERSION`). One may change the default value
  95. if the previous packaging was buggy and/or you want to put here a fancy Linux
  96. distro specific numbering.
  97. .. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE
  98. CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE
  99. The Debian package architecture
  100. :Mandatory: Yes
  101. :Default: Output of ``dpkg --print-architecture`` (or ``i386``
  102. if ``dpkg`` is not found)
  103. .. versionadded:: 3.6
  104. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE` variables.
  105. .. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS
  106. CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS
  107. Sets the Debian dependencies of this package.
  108. :Mandatory: No
  109. :Default:
  110. - An empty string for non-component based installations
  111. - :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS` for component-based
  112. installations.
  113. .. versionadded:: 3.3
  114. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` variables.
  115. .. note::
  116. If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or
  117. more specifically :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS`
  118. is set for this component, the discovered dependencies will be appended
  119. to :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` instead of
  120. :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If
  121. :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` is an empty string,
  122. only the automatically discovered dependencies will be set for this
  123. component.
  124. .. versionchanged:: 3.31
  125. The variable is always expanded as a list. Before it was expanded only
  126. if used in cooperation with :variable:`CPACK_DEB_COMPONENT_INSTALL`,
  127. :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or
  128. :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS`.
  129. This meant that if a component had no shared libraries discovered
  130. (e.g. a package composed only of scripts) you had to join the list
  131. by yourself to obtain a valid Depends field.
  132. Example:
  133. .. code-block:: cmake
  134. set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)")
  135. list(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS cmake)
  136. .. variable:: CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS
  137. .. versionadded:: 3.6
  138. Sets inter-component dependencies if listed with
  139. :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables.
  140. :Mandatory: No
  141. :Default: None
  142. .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER
  143. The Debian package maintainer
  144. :Mandatory: Yes
  145. :Default: :variable:`!CPACK_PACKAGE_CONTACT`
  146. .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION
  147. CPACK_DEBIAN_<COMPONENT>_DESCRIPTION
  148. The Debian package description
  149. :Mandatory: Yes
  150. :Default:
  151. - :variable:`CPACK_DEBIAN_<COMPONENT>_DESCRIPTION` (component
  152. based installers only) if set, or :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set, or
  153. - :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION` (component
  154. based installers only) if set, or :variable:`CPACK_PACKAGE_DESCRIPTION` if set, or
  155. - content of the file specified in :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` if set
  156. If after that description is not set, :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` going to be
  157. used if set. Otherwise, :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` will be added as the first
  158. line of description as defined in `Debian Policy Manual`_.
  159. .. versionadded:: 3.3
  160. Per-component :variable:`!CPACK_COMPONENT_<compName>_DESCRIPTION` variables.
  161. .. versionadded:: 3.16
  162. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_DESCRIPTION` variables.
  163. .. versionadded:: 3.16
  164. The :variable:`!CPACK_PACKAGE_DESCRIPTION_FILE` variable.
  165. .. _Debian Policy Manual: https://www.debian.org/doc/debian-policy/ch-controlfields.html#description
  166. .. variable:: CPACK_DEBIAN_PACKAGE_SECTION
  167. CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION
  168. Set Section control field e.g. admin, devel, doc, ...
  169. :Mandatory: Yes
  170. :Default: ``devel``
  171. .. versionadded:: 3.5
  172. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION` variables.
  173. See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
  174. .. variable:: CPACK_DEBIAN_ARCHIVE_TYPE
  175. .. versionadded:: 3.7
  176. .. deprecated:: 3.14
  177. The archive format used for creating the Debian package.
  178. :Mandatory: Yes
  179. :Default: ``gnutar``
  180. Possible value is: ``gnutar``
  181. .. note::
  182. This variable previously defaulted to the ``paxr`` value, but ``dpkg``
  183. has never supported that tar format. For backwards compatibility the
  184. ``paxr`` value will be mapped to ``gnutar`` and a deprecation message
  185. will be emitted.
  186. .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
  187. .. versionadded:: 3.1
  188. The compression used for creating the Debian package.
  189. :Mandatory: Yes
  190. :Default: ``gzip``
  191. Possible values are:
  192. ``lzma``
  193. Lempel–Ziv–Markov chain algorithm
  194. ``xz``
  195. XZ Utils compression
  196. ``bzip2``
  197. bzip2 Burrows–Wheeler algorithm
  198. ``gzip``
  199. GNU Gzip compression
  200. ``zstd``
  201. .. versionadded:: 3.22
  202. Zstandard compression
  203. .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
  204. CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY
  205. Set Priority control field e.g. required, important, standard, optional,
  206. extra
  207. :Mandatory: Yes
  208. :Default: ``optional``
  209. .. versionadded:: 3.5
  210. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY` variables.
  211. See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities
  212. .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE
  213. The URL of the web site for this package, preferably (when applicable) the
  214. site from which the original source can be obtained and any additional
  215. upstream documentation or information may be found.
  216. :Mandatory: No
  217. :Default: :variable:`CMAKE_PROJECT_HOMEPAGE_URL`
  218. .. versionadded:: 3.12
  219. The :variable:`!CMAKE_PROJECT_HOMEPAGE_URL` variable.
  220. .. note::
  221. The content of this field is a simple URL without any surrounding
  222. characters such as <>.
  223. .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS
  224. CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS
  225. May be set to ON in order to use ``dpkg-shlibdeps`` to generate
  226. better package dependency list.
  227. :Mandatory: No
  228. :Default:
  229. - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` if set or
  230. - ``OFF``
  231. .. note::
  232. You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value
  233. if you use this feature, because if you don't ``dpkg-shlibdeps``
  234. may fail to find your own shared libs.
  235. See https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
  236. .. note::
  237. You can also set :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS`
  238. to an appropriate value if you use this feature, in order to please
  239. ``dpkg-shlibdeps``. However, you should only do this for private
  240. shared libraries that could not get resolved otherwise.
  241. .. versionadded:: 3.3
  242. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS` variables.
  243. .. versionadded:: 3.6
  244. Correct handling of ``$ORIGIN`` in :variable:`CMAKE_INSTALL_RPATH`.
  245. .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS
  246. .. versionadded:: 3.20
  247. May be set to a list of directories that will be given to ``dpkg-shlibdeps``
  248. via its ``-l`` option. These will be searched by ``dpkg-shlibdeps`` in order
  249. to find private shared library dependencies.
  250. :Mandatory: No
  251. :Default: None
  252. .. note::
  253. You should prefer to set :variable:`CMAKE_INSTALL_RPATH` to an appropriate
  254. value if you use ``dpkg-shlibdeps``. The current option is really only
  255. needed for private shared library dependencies.
  256. .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG
  257. May be set when invoking cpack in order to trace debug information
  258. during the CPack DEB generator run.
  259. :Mandatory: No
  260. :Default: None
  261. .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS
  262. CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS
  263. Sets the ``Pre-Depends`` field of the Debian package.
  264. Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it
  265. also forces ``dpkg`` to complete installation of the packages named
  266. before even starting the installation of the package which declares the
  267. pre-dependency.
  268. :Mandatory: No
  269. :Default:
  270. - An empty string for non-component based installations
  271. - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based
  272. installations.
  273. .. versionadded:: 3.4
  274. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS` variables.
  275. See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
  276. .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES
  277. CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES
  278. Sets the ``Enhances`` field of the Debian package.
  279. Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works
  280. in the opposite direction: declares that a package can enhance the
  281. functionality of another package.
  282. :Mandatory: No
  283. :Default:
  284. - An empty string for non-component based installations
  285. - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based
  286. installations.
  287. .. versionadded:: 3.4
  288. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES` variables.
  289. See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
  290. .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS
  291. CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS
  292. Sets the ``Breaks`` field of the Debian package.
  293. When a binary package (P) declares that it breaks other packages (B),
  294. ``dpkg`` will not allow the package (P) which declares ``Breaks`` be
  295. **unpacked** unless the packages that will be broken (B) are deconfigured
  296. first.
  297. As long as the package (P) is configured, the previously deconfigured
  298. packages (B) cannot be reconfigured again.
  299. :Mandatory: No
  300. :Default:
  301. - An empty string for non-component based installations
  302. - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based
  303. installations.
  304. .. versionadded:: 3.4
  305. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS` variables.
  306. See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks
  307. .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
  308. CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS
  309. Sets the ``Conflicts`` field of the Debian package.
  310. When one binary package declares a conflict with another using a ``Conflicts``
  311. field, ``dpkg`` will not allow them to be unpacked on the system at
  312. the same time.
  313. :Mandatory: No
  314. :Default:
  315. - An empty string for non-component based installations
  316. - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based
  317. installations.
  318. .. versionadded:: 3.4
  319. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS` variables.
  320. See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts
  321. .. note::
  322. This is a stronger restriction than
  323. :variable:`Breaks <CPACK_DEBIAN_PACKAGE_BREAKS>`, which prevents the
  324. broken package from being configured while the breaking package is in
  325. the "Unpacked" state but allows both packages to be unpacked at the same
  326. time.
  327. .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES
  328. CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES
  329. Sets the ``Provides`` field of the Debian package.
  330. A virtual package is one which appears in the ``Provides`` control field of
  331. another package.
  332. :Mandatory: No
  333. :Default:
  334. - An empty string for non-component based installations
  335. - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based
  336. installations.
  337. .. versionadded:: 3.4
  338. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES` variables.
  339. See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual
  340. .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
  341. CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES
  342. Sets the ``Replaces`` field of the Debian package.
  343. Packages can declare in their control file that they should overwrite
  344. files in certain other packages, or completely replace other packages.
  345. :Mandatory: No
  346. :Default:
  347. - An empty string for non-component based installations
  348. - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based
  349. installations.
  350. .. versionadded:: 3.4
  351. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES` variables.
  352. See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
  353. .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS
  354. CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS
  355. Sets the ``Recommends`` field of the Debian package.
  356. Allows packages to declare a strong, but not absolute, dependency on other
  357. packages.
  358. :Mandatory: No
  359. :Default:
  360. - An empty string for non-component based installations
  361. - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based
  362. installations.
  363. .. versionadded:: 3.4
  364. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS` variables.
  365. See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
  366. .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
  367. CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS
  368. Sets the ``Suggests`` field of the Debian package.
  369. Allows packages to declare a suggested package install grouping.
  370. :Mandatory: No
  371. :Default:
  372. - An empty string for non-component based installations
  373. - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based
  374. installations.
  375. .. versionadded:: 3.4
  376. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS` variables.
  377. See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
  378. .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS
  379. .. versionadded:: 3.6
  380. :Mandatory: No
  381. :Default: ``OFF``
  382. Allows to generate shlibs control file automatically. Compatibility is defined by
  383. :variable:`CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY` variable value.
  384. .. note::
  385. Libraries are only considered if they have both library name and version
  386. set. This can be done by setting SOVERSION property with
  387. :command:`set_target_properties` command.
  388. .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY
  389. .. versionadded:: 3.6
  390. Compatibility policy for auto-generated shlibs control file.
  391. :Mandatory: No
  392. :Default: ``=``
  393. Defines compatibility policy for auto-generated shlibs control file.
  394. Possible values: ``=``, ``>=``
  395. See https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-sharedlibs-shlibdeps
  396. .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
  397. CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_EXTRA
  398. This variable allow advanced user to add custom script to the
  399. control.tar.gz.
  400. Typical usage is for conffiles, postinst, postrm, prerm.
  401. :Mandatory: No
  402. :Default: None
  403. Usage:
  404. .. code-block:: cmake
  405. set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
  406. "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
  407. .. versionadded:: 3.4
  408. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_EXTRA` variables.
  409. .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION
  410. CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_STRICT_PERMISSION
  411. .. versionadded:: 3.4
  412. This variable indicates if the Debian policy on control files should be
  413. strictly followed.
  414. :Mandatory: No
  415. :Default: ``FALSE``
  416. Usage:
  417. .. code-block:: cmake
  418. set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
  419. This overrides the permissions on the original files, following the rules
  420. set by Debian policy
  421. https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners
  422. .. note::
  423. The original permissions of the files will be used in the final
  424. package unless this variable is set to ``TRUE``.
  425. In particular, the scripts should have the proper executable
  426. flag prior to the generation of the package.
  427. .. variable:: CPACK_DEBIAN_PACKAGE_SOURCE
  428. CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE
  429. .. versionadded:: 3.5
  430. Sets the ``Source`` field of the binary Debian package.
  431. When the binary package name is not the same as the source package name
  432. (in particular when several components/binaries are generated from one
  433. source) the source from which the binary has been generated should be
  434. indicated with the field ``Source``.
  435. :Mandatory: No
  436. :Default:
  437. - An empty string for non-component based installations
  438. - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based
  439. installations.
  440. See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-source
  441. .. note::
  442. This value is not interpreted. It is possible to pass an optional
  443. revision number of the referenced source package as well.
  444. .. variable:: CPACK_DEBIAN_PACKAGE_MULTIARCH
  445. CPACK_DEBIAN_<COMPONENT>_PACKAGE_MULTIARCH
  446. Sets the ``Multi-Arch`` field of the Debian package.
  447. Packages can declare in their control file how they should handle
  448. situations, where packages for different architectures are being installed
  449. on the same machine.
  450. :Mandatory: No
  451. :Default:
  452. - An empty string for non-component based installations
  453. - :variable:`CPACK_DEBIAN_PACKAGE_MULTIARCH` for component-based
  454. installations.
  455. .. versionadded:: 3.31
  456. Per-component :variable:`!CPACK_DEBIAN_<COMPONENT>_PACKAGE_MULTIARCH` variables.
  457. See https://wiki.debian.org/MultiArch/Hints
  458. .. note::
  459. This value is validated. It must be one of the following values:
  460. ``same``, ``foreign``, ``allowed``.
  461. Packaging of debug information
  462. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  463. .. versionadded:: 3.13
  464. Dbgsym packages contain debug symbols for debugging packaged binaries.
  465. Dbgsym packaging has its own set of variables:
  466. .. variable:: CPACK_DEBIAN_DEBUGINFO_PACKAGE
  467. CPACK_DEBIAN_<component>_DEBUGINFO_PACKAGE
  468. Enable generation of dbgsym .ddeb package(s).
  469. :Mandatory: No
  470. :Default: ``OFF``
  471. .. note::
  472. Setting this also strips the ELF files in the generated non-dbgsym package,
  473. which results in debuginfo only being available in the dbgsym package.
  474. .. note::
  475. Binaries must contain debug symbols before packaging so use either ``Debug``
  476. or ``RelWithDebInfo`` for :variable:`CMAKE_BUILD_TYPE` variable value.
  477. Additionally, if :variable:`CPACK_STRIP_FILES` is set, the files will be stripped before
  478. they get to the DEB generator, so will not contain debug symbols and
  479. a dbgsym package will not get built. Do not use with :variable:`CPACK_STRIP_FILES`.
  480. Building Debian packages on Windows
  481. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  482. .. versionadded:: 3.10
  483. To communicate UNIX file permissions from the install stage
  484. to the CPack DEB generator the ``cmake_mode_t`` NTFS
  485. alternate data stream (ADT) is used.
  486. When a filesystem without ADT support is used only owner read/write
  487. permissions can be preserved.
  488. Reproducible packages
  489. ^^^^^^^^^^^^^^^^^^^^^
  490. .. versionadded:: 3.13
  491. The environment variable :envvar:`!SOURCE_DATE_EPOCH` may be set to a UNIX
  492. timestamp, defined as the number of seconds, excluding leap seconds,
  493. since 01 Jan 1970 00:00:00 UTC. If set, the CPack DEB generator will
  494. use its value for timestamps in the package.