cpack.1.rst 3.99 KB
Newer Older
1 2
.. cmake-manual-description: CPack Command-Line Reference

3 4 5
cpack(1)
********

6 7
Synopsis
========
8

9
.. parsed-literal::
10

11
 cpack [<options>]
12

13 14 15
Description
===========

16
The **cpack** executable is the CMake packaging program.  It generates
17 18
installers and source packages in a variety of formats.

19
For each installer or package format, **cpack** has a specific backend,
20 21 22 23 24 25 26 27 28 29 30
called "generator". A generator is responsible for generating the required
inputs and invoking the specific package creation tools. These installer
or package generators are not to be confused with the makefile generators
of the :manual:`cmake <cmake(1)>` command.

All supported generators are specified in the :manual:`cpack-generators
<cpack-generators(7)>` manual.  The command ``cpack --help`` prints a
list of generators supported for the target platform.  Which of them are
to be used can be selected through the :variable:`CPACK_GENERATOR` variable
or through the command-line option ``-G``.

31
The **cpack** program is steered by a configuration file written in the
32 33 34 35 36 37 38
:manual:`CMake language <cmake-language(7)>`. Unless chosen differently
through the command-line option ``--config``, the file ``CPackConfig.cmake``
in the current directory is used.

In the standard CMake workflow, the file ``CPackConfig.cmake`` is generated
by the :manual:`cmake <cmake(1)>` executable, provided the :module:`CPack`
module is included by the project's ``CMakeLists.txt`` file.
39

40 41
Options
=======
42

43 44 45 46
``-G <generators>``
  ``<generators>`` is a :ref:`semicolon-separated list <CMake Language Lists>`
  of generator names.  ``cpack`` will iterate through this list and produce
  package(s) in that generator's format according to the details provided in
47 48 49
  the ``CPackConfig.cmake`` configuration file.  If this option is not given,
  the :variable:`CPACK_GENERATOR` variable determines the default set of
  generators that will be used.
50

51
``-C <Configuration>``
52 53 54 55
  Specify the project configuration to be packaged (e.g. ``Debug``,
  ``Release``, etc.).  When the CMake project uses a multi-configuration
  generator such as Xcode or Visual Studio, this option is needed to tell
  ``cpack`` which built executables to include in the package.
56

57
``-D <var>=<value>``
58 59
  Set a CPack variable.  This will override any value set for ``<var>`` in the
  input file read by ``cpack``.
60

61 62 63 64
``--config <configFile>``
  Specify the configuration file read by ``cpack`` to provide the packaging
  details.  By default, ``CPackConfig.cmake`` in the current directory will
  be used.
65

66
``--verbose, -V``
67 68
  Run ``cpack`` with verbose output.  This can be used to show more details
  from the package generation tools and is suitable for project developers.
69

70
``--debug``
71 72 73
  Run ``cpack`` with debug output.  This option is intended mainly for the
  developers of ``cpack`` itself and is not normally needed by project
  developers.
74

75
``--trace``
76
  Put the underlying cmake scripts in trace mode.
77 78

``--trace-expand``
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
  Put the underlying cmake scripts in expanded trace mode.

``-P <packageName>``
  Override/define the value of the :variable:`CPACK_PACKAGE_NAME` variable used
  for packaging.  Any value set for this variable in the ``CPackConfig.cmake``
  file will then be ignored.

``-R <packageVersion>``
  Override/define the value of the :variable:`CPACK_PACKAGE_VERSION`
  variable used for packaging.  It will override a value set in the
  ``CPackConfig.cmake`` file or one automatically computed from
  :variable:`CPACK_PACKAGE_VERSION_MAJOR`,
  :variable:`CPACK_PACKAGE_VERSION_MINOR` and
  :variable:`CPACK_PACKAGE_VERSION_PATCH`.

``-B <packageDirectory>``
  Override/define :variable:`CPACK_PACKAGE_DIRECTORY`, which controls the
  directory where CPack will perform its packaging work.  The resultant
  package(s) will be created at this location by default and a
  ``_CPack_Packages`` subdirectory will also be created below this directory to
  use as a working area during package creation.

``--vendor <vendorName>``
  Override/define :variable:`CPACK_PACKAGE_VENDOR`.
103

104
.. include:: OPTIONS_HELP.txt
105

106 107
See Also
========
108

109
.. include:: LINKS.txt