CMake:CPackPackageGenerators

From KitwarePublic
Jump to navigationJump to search

CPack Package Generators

Currently CPack features the following package generators:

TGZ

Tar GZip compressed packages.

STGZ

Self extracting Tar GZip compressed packages (needs /bin/sh, tar, gunzip and tail for extracting).

NSIS

Nullsoft Installer. Requires NSIS for creating the package.

ZIP

ZIP compressed packages. Requires zip, WinZip or 7Zip for creating the package. 7Zip support is only available in future version of CMake and can not be used with CMake Version earlier then 2.4.7.

TBZ2

Tar BZip2 compressed packages. Requires bzip2 for creating the package.

TZ

Tar UNIX compress compressed packages.

PackageMaker (OSX only)

Mac OSX Package Maker packages. Requires Package Maker for creating the package.

OSXX11 (OSX only)

Mac OSX X11 Bundle. Requires hdiutil for creating the package.

CygwinBinary (Cygwin only)

Tar Bzip2 compressed Cygwin package. Requires bzip2 for creating the package.

CygwinSource (Cygwin only)

Tar Bzip2 compressed Cygwin source package. Requires bzip2 for creating the package.

DEB (UNIX only)

Debian packages (2.0 version only, see the debian-binary file). In CMake cvs since July 2007, will be in 2.6.0. With CPack 2.4.x you can use the approach described in CMakeUserUseDebian (Requires only ar for creating the package). Warning: due to an incompatibility between GNU-ar and BSD-ar this is not a long-term recommended solution. Instead you should switch to the solution implemented in 2.6.x where a BSD-ar implementation was integrated in CPack.

Reference: [libapt-inst] Should support both BSD and SysV ar formats

Note: Only binary package are supported. source package do not really make sense since build process is cmake driven.

Here are the variables needed for a binary package:

control file (aka DEBIAN/control) for binary package

Specific variables are needed to generate the control file for debian package: See also: [1]

package name

  • debian policy enforce lower case for package name
  • Package: (mandatory)
  • if CPACK_DEBIAN_PACKAGE_NAME is not set CPACK_PACKAGE_NAME (lower case will be used)

version

  • Version: (mandatory)
  • if CPACK_DEBIAN_PACKAGE_VERSION is not set CPACK_PACKAGE_VERSION

arch

  • Architecture: (mandatory)
  • if not set CPACK_DEBIAN_PACKAGE_ARCHITECTURE will be set to i386

Notes:

  • should be set via: dpkg --print-architecture
  • There is no such thing as i686 architecture on debian, you should use i386 instead

depends

  • Depends:
  • You should set: CPACK_DEBIAN_PACKAGE_DEPENDS
  • eg.:
   SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12)")

Notes:

  • have a look at GET_PROPERTY(result GLOBAL ENABLED_FEATURES), this returns the successful FIND_PACKAGE() calls, maybe this can help
  • TODO: automate 'objdump -p | grep NEEDED'

maintaner

  • Maintainer: (mandatory)
    • valid email is required
  • if DEBIAN_PACKAGE_MAINTAINER is not set, CPACK_PACKAGE_CONTACT will be used instead

description

  • Description: (mandatory)
  • if DEBIAN_PACKAGE_DESCRIPTION is not set CPACK_PACKAGE_DESCRIPTION_SUMMARY will be used instead.

section

  • Section: (recommended)
  • if not set DEBIAN_PACKAGE_SECTION will default to 'devel'

priority

  • Priority: (recommended)
  • if not set DEBIAN_PACKAGE_PRIORITY will be set to "optional"

recommends

  • Recommends:
  • You should set: DEBIAN_PACKAGE_RECOMMENDS

Suggests

  • Suggests:
  • You should set: DEBIAN_PACKAGE_SUGGESTS

Source (for reference only)

Here are the variables needed for a source package (not implemented):

  • .dsc
  • see also [2]

Most of them are identical with the binary package, with exception:

builds-depends

  • DEBIAN_PACKAGE_BUILDS_DEPENDS
  • eg.:
"debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"

External references

RPM (Unix Only)

Binary RPM packages are supported by CMake (more precisely by CPack) since CMake 2.6.0. If you use CMake 2.4.x (or you want to build source RPM) you may use the CMakeUserUseRPMTools module.

CPack RPM usage

The CPack RPM generator is not different from other CPack generator it's execution is controlled both using:

  • generic CPACK_xxxx variables see CPack variables
  • specific CPACK_RPM_xxxx variables see generator specific wiki pages

CPack RPM generators specific variables

CPack RPM specific variables are used to generate an RPM spec file which will be processed by the rpmbuild tool. A specific variable may be

  • mandatory with default value
  • mandatory
  • optional

Here is the list of CPack RPM specific variables:

Variable Name Description Default value Example
CPACK_RPM_PACKAGE_SUMMARY Package summary CPACK_PACKAGE_DESCRIPTION_SUMMARY -
CPACK_RPM_PACKAGE_NAME The package name CPACK_PACKAGE_NAME) -

Historical Notes

The built-in CPack support for RPM is based on the work done in the RPM module. The builtin CPack 2.6.x support for RPM is for binary package only but the binary RPM package built faster using CPack than CMakeUserUseRPMTools module. This restriction is due to both a lack of time of the implementor (--Erk 05:01, 7 September 2007 (EDT)) and some design issues in current CPack .

The CMakeUserUseRPMTools module should be usable both with CMake 2.4.x and forthcoming CMake 2.6.x.

For an enhanced version of these modules, take a look at this discussion http://www.cmake.org/pipermail/cmake/2007-July/014945.html.