395cd4189c2b9d53818d1f1a6ed043d95e3f2b89
[platform/upstream/cmake.git] / Help / manual / cpack.1.rst
1 .. cmake-manual-description: CPack Command-Line Reference
2
3 cpack(1)
4 ********
5
6 Synopsis
7 ========
8
9 .. parsed-literal::
10
11  cpack [<options>]
12
13 Description
14 ===========
15
16 The **cpack** executable is the CMake packaging program.  It generates
17 installers and source packages in a variety of formats.
18
19 For each installer or package format, **cpack** has a specific backend,
20 called "generator". A generator is responsible for generating the required
21 inputs and invoking the specific package creation tools. These installer
22 or package generators are not to be confused with the makefile generators
23 of the :manual:`cmake <cmake(1)>` command.
24
25 All supported generators are specified in the :manual:`cpack-generators
26 <cpack-generators(7)>` manual.  The command ``cpack --help`` prints a
27 list of generators supported for the target platform.  Which of them are
28 to be used can be selected through the :variable:`CPACK_GENERATOR` variable
29 or through the command-line option ``-G``.
30
31 The **cpack** program is steered by a configuration file written in the
32 :manual:`CMake language <cmake-language(7)>`. Unless chosen differently
33 through the command-line option ``--config``, the file ``CPackConfig.cmake``
34 in the current directory is used.
35
36 In the standard CMake workflow, the file ``CPackConfig.cmake`` is generated
37 by the :manual:`cmake <cmake(1)>` executable, provided the :module:`CPack`
38 module is included by the project's ``CMakeLists.txt`` file.
39
40 Options
41 =======
42
43 ``-G <generators>``
44   ``<generators>`` is a :ref:`semicolon-separated list <CMake Language Lists>`
45   of generator names.  ``cpack`` will iterate through this list and produce
46   package(s) in that generator's format according to the details provided in
47   the ``CPackConfig.cmake`` configuration file.  If this option is not given,
48   the :variable:`CPACK_GENERATOR` variable determines the default set of
49   generators that will be used.
50
51 ``-C <configs>``
52   Specify the project configuration(s) to be packaged (e.g. ``Debug``,
53   ``Release``, etc.), where ``<configs>`` is a
54   :ref:`semicolon-separated list <CMake Language Lists>`.
55   When the CMake project uses a multi-configuration
56   generator such as Xcode or Visual Studio, this option is needed to tell
57   ``cpack`` which built executables to include in the package.
58   The user is responsible for ensuring that the configuration(s) listed
59   have already been built before invoking ``cpack``.
60
61 ``-D <var>=<value>``
62   Set a CPack variable.  This will override any value set for ``<var>`` in the
63   input file read by ``cpack``.
64
65 ``--config <configFile>``
66   Specify the configuration file read by ``cpack`` to provide the packaging
67   details.  By default, ``CPackConfig.cmake`` in the current directory will
68   be used.
69
70 ``--verbose, -V``
71   Run ``cpack`` with verbose output.  This can be used to show more details
72   from the package generation tools and is suitable for project developers.
73
74 ``--debug``
75   Run ``cpack`` with debug output.  This option is intended mainly for the
76   developers of ``cpack`` itself and is not normally needed by project
77   developers.
78
79 ``--trace``
80   Put the underlying cmake scripts in trace mode.
81
82 ``--trace-expand``
83   Put the underlying cmake scripts in expanded trace mode.
84
85 ``-P <packageName>``
86   Override/define the value of the :variable:`CPACK_PACKAGE_NAME` variable used
87   for packaging.  Any value set for this variable in the ``CPackConfig.cmake``
88   file will then be ignored.
89
90 ``-R <packageVersion>``
91   Override/define the value of the :variable:`CPACK_PACKAGE_VERSION`
92   variable used for packaging.  It will override a value set in the
93   ``CPackConfig.cmake`` file or one automatically computed from
94   :variable:`CPACK_PACKAGE_VERSION_MAJOR`,
95   :variable:`CPACK_PACKAGE_VERSION_MINOR` and
96   :variable:`CPACK_PACKAGE_VERSION_PATCH`.
97
98 ``-B <packageDirectory>``
99   Override/define :variable:`CPACK_PACKAGE_DIRECTORY`, which controls the
100   directory where CPack will perform its packaging work.  The resultant
101   package(s) will be created at this location by default and a
102   ``_CPack_Packages`` subdirectory will also be created below this directory to
103   use as a working area during package creation.
104
105 ``--vendor <vendorName>``
106   Override/define :variable:`CPACK_PACKAGE_VENDOR`.
107
108 .. include:: OPTIONS_HELP.txt
109
110 See Also
111 ========
112
113 .. include:: LINKS.txt