| 12
 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
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 
 | CPack DEB Generator
-------------------
The built in (binary) CPack DEB generator (Unix only)
Variables specific to CPack Debian (DEB) generator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The CPack DEB generator may be used to create DEB package using :module:`CPack`.
The CPack DEB generator is a :module:`CPack` generator thus it uses the
``CPACK_XXX`` variables used by :module:`CPack`.
The CPack DEB generator should work on any Linux host but it will produce
better deb package when Debian specific tools ``dpkg-xxx`` are usable on
the build system.
The CPack DEB generator has specific features which are controlled by the
specifics :code:`CPACK_DEBIAN_XXX` variables.
:code:`CPACK_DEBIAN_<COMPONENT>_XXXX` variables may be used in order to have
**component** specific values.  Note however that ``<COMPONENT>`` refers to
the **grouping name** written in upper case. It may be either a component name
or a component GROUP name.
Here are some CPack DEB generator wiki resources that are here for historic
reasons and are no longer maintained but may still prove useful:
 - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration
 - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#deb-unix-only
List of CPack DEB generator specific variables:
.. variable:: CPACK_DEB_COMPONENT_INSTALL
 Enable component packaging for CPackDEB
 * Mandatory : NO
 * Default   : OFF
 If enabled (ON) multiple packages are generated. By default a single package
 containing files of all components is generated.
.. variable:: CPACK_DEBIAN_PACKAGE_NAME
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME
 Set Package control field (variable is automatically transformed to lower
 case).
 * Mandatory : YES
 * Default   :
   - :variable:`CPACK_PACKAGE_NAME` for non-component based
     installations
   - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with -<COMPONENT>
     for component-based installations.
 See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source
.. variable:: CPACK_DEBIAN_FILE_NAME
              CPACK_DEBIAN_<COMPONENT>_FILE_NAME
 Package file name.
 * Mandatory : YES
 * Default   : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].deb``
 This may be set to ``DEB-DEFAULT`` to allow the CPack DEB generator to generate
 package file name by itself in deb format::
   <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
 Alternatively provided package file name must end
 with either ``.deb`` or ``.ipk`` suffix.
 .. note::
   Preferred setting of this variable is ``DEB-DEFAULT`` but for backward
   compatibility with the CPack DEB generator in CMake prior to version 3.6 this
   feature is disabled by default.
 .. note::
   By using non default filenames duplicate names may occur. Duplicate files
   get overwritten and it is up to the packager to set the variables in a
   manner that will prevent such errors.
.. variable:: CPACK_DEBIAN_PACKAGE_EPOCH
 The Debian package epoch
 * Mandatory : No
 * Default   : -
 Optional number that should be incremented when changing versioning schemas
 or fixing mistakes in the version numbers of older packages.
.. variable:: CPACK_DEBIAN_PACKAGE_VERSION
 The Debian package version
 * Mandatory : YES
 * Default   : :variable:`CPACK_PACKAGE_VERSION`
 This variable may contain only alphanumerics (A-Za-z0-9) and the characters
 . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If
 :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` is not set then hyphens are not
 allowed.
 .. note::
   For backward compatibility with CMake 3.9 and lower a failed test of this
   variable's content is not a hard error when both
   :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` and
   :variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables are not set. An author
   warning is reported instead.
.. variable:: CPACK_DEBIAN_PACKAGE_RELEASE
 The Debian package release - Debian revision number.
 * Mandatory : No
 * Default   : -
 This is the numbering of the DEB package itself, i.e. the version of the
 packaging and not the version of the content (see
 :variable:`CPACK_DEBIAN_PACKAGE_VERSION`). One may change the default value
 if the previous packaging was buggy and/or you want to put here a fancy Linux
 distro specific numbering.
.. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE
 The Debian package architecture
 * Mandatory : YES
 * Default   : Output of :code:`dpkg --print-architecture` (or :code:`i386`
   if :code:`dpkg` is not found)
.. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS
 Sets the Debian dependencies of this package.
 * Mandatory : NO
 * Default   :
   - An empty string for non-component based installations
   - :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS` for component-based
     installations.
 .. note::
   If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or
   more specifically :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS`
   is set for this component, the discovered dependencies will be appended
   to :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` instead of
   :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If
   :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` is an empty string,
   only the automatically discovered dependencies will be set for this
   component.
 Example::
   set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)")
.. variable:: CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS
 Sets inter component dependencies if listed with
 :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables.
 * Mandatory : NO
 * Default   : -
.. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER
 The Debian package maintainer
 * Mandatory : YES
 * Default   : :code:`CPACK_PACKAGE_CONTACT`
.. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION
              CPACK_COMPONENT_<COMPONENT>_DESCRIPTION
 The Debian package description
 * Mandatory : YES
 * Default   :
   - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or
   - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
.. variable:: CPACK_DEBIAN_PACKAGE_SECTION
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION
 Set Section control field e.g. admin, devel, doc, ...
 * Mandatory : YES
 * Default   : "devel"
 See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
.. variable:: CPACK_DEBIAN_ARCHIVE_TYPE
 The archive format used for creating the Debian package.
 * Mandatory : YES
 * Default   : "paxr"
 Possible values are:
 - paxr
 - gnutar
 .. note::
   Default pax archive format is the most portable format and generates
   packages that do not treat sparse files specially.
   GNU tar format on the other hand supports longer filenames.
.. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
 The compression used for creating the Debian package.
 * Mandatory : YES
 * Default   : "gzip"
 Possible values are:
 - lzma
 - xz
 - bzip2
 - gzip
.. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY
 Set Priority control field e.g. required, important, standard, optional,
 extra
 * Mandatory : YES
 * Default   : "optional"
 See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities
.. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE
 The URL of the web site for this package, preferably (when applicable) the
 site from which the original source can be obtained and any additional
 upstream documentation or information may be found.
 * Mandatory : NO
 * Default   : :variable:`CMAKE_PROJECT_HOMEPAGE_URL`
 .. note::
   The content of this field is a simple URL without any surrounding
   characters such as <>.
.. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS
 May be set to ON in order to use :code:`dpkg-shlibdeps` to generate
 better package dependency list.
 * Mandatory : NO
 * Default   :
   - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` if set or
   - OFF
 .. note::
   You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value
   if you use this feature, because if you don't :code:`dpkg-shlibdeps`
   may fail to find your own shared libs.
   See https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
.. variable:: CPACK_DEBIAN_PACKAGE_DEBUG
 May be set when invoking cpack in order to trace debug information
 during the CPack DEB generator run.
 * Mandatory : NO
 * Default   : -
.. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS
 Sets the `Pre-Depends` field of the Debian package.
 Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it
 also forces :code:`dpkg` to complete installation of the packages named
 before even starting the installation of the package which declares the
 pre-dependency.
 * Mandatory : NO
 * Default   :
   - An empty string for non-component based installations
   - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based
     installations.
 See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
.. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES
 Sets the `Enhances` field of the Debian package.
 Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works
 in the opposite direction: declares that a package can enhance the
 functionality of another package.
 * Mandatory : NO
 * Default   :
   - An empty string for non-component based installations
   - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based
     installations.
 See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
.. variable:: CPACK_DEBIAN_PACKAGE_BREAKS
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS
 Sets the `Breaks` field of the Debian package.
 When a binary package (P) declares that it breaks other packages (B),
 :code:`dpkg` will not allow the package (P) which declares `Breaks` be
 **unpacked** unless the packages that will be broken (B) are deconfigured
 first.
 As long as the package (P) is configured, the previously deconfigured
 packages (B) cannot be reconfigured again.
 * Mandatory : NO
 * Default   :
   - An empty string for non-component based installations
   - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based
     installations.
 See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks
.. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS
 Sets the `Conflicts` field of the Debian package.
 When one binary package declares a conflict with another using a `Conflicts`
 field, :code:`dpkg` will not allow them to be unpacked on the system at
 the same time.
 * Mandatory : NO
 * Default   :
   - An empty string for non-component based installations
   - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based
     installations.
 See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts
 .. note::
   This is a stronger restriction than
   :variable:`Breaks <CPACK_DEBIAN_PACKAGE_BREAKS>`, which prevents the
   broken package from being configured while the breaking package is in
   the "Unpacked" state but allows both packages to be unpacked at the same
   time.
.. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES
 Sets the `Provides` field of the Debian package.
 A virtual package is one which appears in the `Provides` control field of
 another package.
 * Mandatory : NO
 * Default   :
   - An empty string for non-component based installations
   - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based
     installations.
 See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual
.. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES
 Sets the `Replaces` field of the Debian package.
 Packages can declare in their control file that they should overwrite
 files in certain other packages, or completely replace other packages.
 * Mandatory : NO
 * Default   :
   - An empty string for non-component based installations
   - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based
     installations.
 See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
.. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS
 Sets the `Recommends` field of the Debian package.
 Allows packages to declare a strong, but not absolute, dependency on other
 packages.
 * Mandatory : NO
 * Default   :
   - An empty string for non-component based installations
   - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based
     installations.
 See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
.. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS
 Sets the `Suggests` field of the Debian package.
 Allows packages to declare a suggested package install grouping.
 * Mandatory : NO
 * Default   :
   - An empty string for non-component based installations
   - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based
     installations.
 See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
.. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS
 * Mandatory : NO
 * Default   : OFF
 Allows to generate shlibs control file automatically. Compatibility is defined by
 :variable:`CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY` variable value.
 .. note::
   Libraries are only considered if they have both library name and version
   set. This can be done by setting SOVERSION property with
   :command:`set_target_properties` command.
.. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY
 Compatibility policy for auto-generated shlibs control file.
 * Mandatory : NO
 * Default   : "="
 Defines compatibility policy for auto-generated shlibs control file.
 Possible values: "=", ">="
 See https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-sharedlibs-shlibdeps
.. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_EXTRA
 This variable allow advanced user to add custom script to the
 control.tar.gz.
 Typical usage is for conffiles, postinst, postrm, prerm.
 * Mandatory : NO
 * Default   : -
 Usage::
  set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
      "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
 .. note::
   The original permissions of the files will be used in the final
   package unless the variable
   :variable:`CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION` is set.
   In particular, the scripts should have the proper executable
   flag prior to the generation of the package.
.. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_STRICT_PERMISSION
 This variable indicates if the Debian policy on control files should be
 strictly followed.
 * Mandatory : NO
 * Default   : FALSE
 Usage::
  set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
 .. note::
   This overrides the permissions on the original files, following the rules
   set by Debian policy
   https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners
.. variable:: CPACK_DEBIAN_PACKAGE_SOURCE
              CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE
 Sets the ``Source`` field of the binary Debian package.
 When the binary package name is not the same as the source package name
 (in particular when several components/binaries are generated from one
 source) the source from which the binary has been generated should be
 indicated with the field ``Source``.
 * Mandatory : NO
 * Default   :
   - An empty string for non-component based installations
   - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based
     installations.
 See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source
 .. note::
   This value is not interpreted. It is possible to pass an optional
   revision number of the referenced source package as well.
Packaging of debug information
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dbgsym packages contain debug symbols for debugging packaged binaries.
Dbgsym packaging has its own set of variables:
.. variable:: CPACK_DEBIAN_DEBUGINFO_PACKAGE
              CPACK_DEBIAN_<component>_DEBUGINFO_PACKAGE
 Enable generation of dbgsym .ddeb package(s).
 * Mandatory : NO
 * Default   : OFF
.. note::
 Binaries must contain debug symbols before packaging so use either ``Debug``
 or ``RelWithDebInfo`` for :variable:`CMAKE_BUILD_TYPE` variable value.
Building Debian packages on Windows
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To communicate UNIX file permissions from the install stage
to the CPack DEB generator the "cmake_mode_t" NTFS
alternate data stream (ADT) is used.
When a filesystem without ADT support is used only owner read/write
permissions can be preserved.
Reproducible packages
^^^^^^^^^^^^^^^^^^^^^
The environment variable ``SOURCE_DATE_EPOCH`` may be set to a UNIX
timestamp, defined as the number of seconds, excluding leap seconds,
since 01 Jan 1970 00:00:00 UTC.  If set, the CPack DEB generator will
use its value for timestamps in the package.
 |