CPackDeb

The builtin (binary) CPack Deb generator (Unix only)

Variables specific to CPack Debian (DEB) generator

CPackDeb may be used to create Deb package using CPack. CPackDeb is a CPack generator thus it uses the CPACK_XXX variables used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration. CPackDeb 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.

CPackDeb has specific features which are controlled by the specifics CPACK_DEBIAN_XXX variables.

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.

You’ll find a detailed usage on the wiki: http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 . However as a handy reminder here comes the list of specific variables:

CPACK_DEBIAN_PACKAGE_NAME

The Debian package summary

CPACK_DEBIAN_PACKAGE_VERSION

The Debian package version

CPACK_DEBIAN_PACKAGE_ARCHITECTURE

The Debian package architecture

  • Mandatory : YES

  • Default : Output of dpkg --print-architecture (or i386 if dpkg is not found)

CPACK_DEBIAN_PACKAGE_DEPENDS
CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS

Sets the Debian dependencies of this package.

  • Mandatory : NO

  • Default :

Note

If CPACK_DEBIAN_PACKAGE_SHLIBDEPS or more specifically CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS is set for this component, the discovered dependencies will be appended to CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS instead of CPACK_DEBIAN_PACKAGE_DEPENDS. If 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)")
CPACK_DEBIAN_PACKAGE_MAINTAINER

The Debian package maintainer

  • Mandatory : YES

  • Default : CPACK_PACKAGE_CONTACT

CPACK_DEBIAN_PACKAGE_DESCRIPTION
CPACK_COMPONENT_<COMPONENT>_DESCRIPTION

The Debian package description

CPACK_DEBIAN_PACKAGE_SECTION
  • Mandatory : YES

  • Default : ‘devel’

CPACK_DEBIAN_COMPRESSION_TYPE

The compression used for creating the Debian package. Possible values are: lzma, xz, bzip2 and gzip.

  • Mandatory : YES

  • Default : ‘gzip’

CPACK_DEBIAN_PACKAGE_PRIORITY

The Debian package priority

  • Mandatory : YES

  • Default : ‘optional’

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 : -

Note

The content of this field is a simple URL without any surrounding characters such as <>.

CPACK_DEBIAN_PACKAGE_SHLIBDEPS
CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS

May be set to ON in order to use dpkg-shlibdeps to generate better package dependency list.

Note

You may need set CMAKE_INSTALL_RPATH to an appropriate value if you use this feature, because if you don’t dpkg-shlibdeps may fail to find your own shared libs. See http://www.cmake.org/Wiki/CMake_RPATH_handling.

CPACK_DEBIAN_PACKAGE_DEBUG

May be set when invoking cpack in order to trace debug information during CPackDeb run.

  • Mandatory : NO

  • Default : -

CPACK_DEBIAN_PACKAGE_PREDEPENDS

Sets the Pre-Depends field of the Debian package. Like Depends, except that it also forces dpkg to complete installation of the packages named before even starting the installation of the package which declares the pre-dependency.

  • Mandatory : NO

  • Default : -

See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps

CPACK_DEBIAN_PACKAGE_ENHANCES

Sets the Enhances field of the Debian package. Similar to Suggests but works in the opposite direction: declares that a package can enhance the functionality of another package.

  • Mandatory : NO

  • Default : -

See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps

CPACK_DEBIAN_PACKAGE_BREAKS

Sets the Breaks field of the Debian package. When a binary package (P) declares that it breaks other packages (B), 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 : -

See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks

CPACK_DEBIAN_PACKAGE_CONFLICTS

Sets the Conflicts field of the Debian package. When one binary package declares a conflict with another using a Conflicts field, dpkg will not allow them to be unpacked on the system at the same time.

  • Mandatory : NO

  • Default : -

See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts

Note

This is a stronger restriction than 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.

CPACK_DEBIAN_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 : -

See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual

CPACK_DEBIAN_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 : -

See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps

CPACK_DEBIAN_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 : -

See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps

CPACK_DEBIAN_PACKAGE_SUGGESTS

Sets the Suggests field of the Debian package. Allows packages to declare a suggested package install grouping.

  • Mandatory : NO

  • Default : -

See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps

CPACK_DEBIAN_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")