1CPack Archive Generator
2-----------------------
3
4CPack generator for packaging files into an archive, which can have
5any of the following formats:
6
7  - 7Z - 7zip - (.7z)
8  - TBZ2 (.tar.bz2)
9  - TGZ (.tar.gz)
10  - TXZ (.tar.xz)
11  - TZ (.tar.Z)
12  - TZST (.tar.zst)
13  - ZIP (.zip)
14
15.. versionadded:: 3.1
16  ``7Z`` and ``TXZ`` formats support.
17
18.. versionadded:: 3.16
19  ``TZST`` format support.
20
21When this generator is called from ``CPackSourceConfig.cmake`` (or through
22the ``package_source`` target), then the generated archive will contain all
23files in the project directory, except those specified in
24:variable:`CPACK_SOURCE_IGNORE_FILES`.  The following is one example of
25packaging all source files of a project:
26
27.. code-block:: cmake
28
29  set(CPACK_SOURCE_GENERATOR "TGZ")
30  set(CPACK_SOURCE_IGNORE_FILES
31    \\.git/
32    build/
33    ".*~$"
34  )
35  set(CPACK_VERBATIM_VARIABLES YES)
36  include(CPack)
37
38When this generator is called from ``CPackConfig.cmake`` (or through the
39``package`` target), then the generated archive will contain all files
40that have been installed via CMake's :command:`install` command (and the
41deprecated commands :command:`install_files`, :command:`install_programs`,
42and :command:`install_targets`).
43
44Variables specific to CPack Archive generator
45^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46
47.. variable:: CPACK_ARCHIVE_FILE_NAME
48              CPACK_ARCHIVE_<component>_FILE_NAME
49
50  Package file name without extension. The extension is determined from the
51  archive format (see list above) and automatically appended to the file name.
52  The default is ``<CPACK_PACKAGE_FILE_NAME>[-<component>]``, with spaces
53  replaced by '-'.
54
55  .. versionadded:: 3.9
56    Per-component ``CPACK_ARCHIVE_<component>_FILE_NAME`` variables.
57
58.. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL
59
60  Enable component packaging. If enabled (ON), then the archive generator
61  creates  multiple packages. The default is OFF, which means that a single
62  package containing files of all components is generated.
63
64Variables used by CPack Archive generator
65^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
67These variables are used by the Archive generator, but are also available to
68CPack generators which are essentially archives at their core. These include:
69
70  - :cpack_gen:`CPack Cygwin Generator`
71  - :cpack_gen:`CPack FreeBSD Generator`
72
73.. variable:: CPACK_ARCHIVE_THREADS
74
75  .. versionadded:: 3.18
76
77  The number of threads to use when performing the compression. If set to
78  ``0``, the number of available cores on the machine will be used instead.
79  The default is ``1`` which limits compression to a single thread. Note that
80  not all compression modes support threading in all environments. Currently,
81  only the XZ compression may support it.
82
83  See also the :variable:`CPACK_THREADS` variable.
84
85  .. versionadded:: 3.21
86
87    Official CMake binaries available on ``cmake.org`` now ship
88    with a ``liblzma`` that supports parallel compression.
89    Older versions did not.
90