1 CPack Archive Generator
2 -----------------------
4 CPack generator for packaging files into an archive, which can have
5 any of the following formats:
16 ``7Z`` and ``TXZ`` formats support.
18 .. versionadded:: 3.16
19 ``TZST`` format support.
21 When this generator is called from ``CPackSourceConfig.cmake`` (or through
22 the ``package_source`` target), then the generated archive will contain all
23 files in the project directory, except those specified in
24 :variable:`CPACK_SOURCE_IGNORE_FILES`. The following is one example of
25 packaging all source files of a project:
29 set(CPACK_SOURCE_GENERATOR "TGZ")
30 set(CPACK_SOURCE_IGNORE_FILES
35 set(CPACK_VERBATIM_VARIABLES YES)
38 When this generator is called from ``CPackConfig.cmake`` (or through the
39 ``package`` target), then the generated archive will contain all files
40 that have been installed via CMake's :command:`install` command (and the
41 deprecated commands :command:`install_files`, :command:`install_programs`,
42 and :command:`install_targets`).
44 Variables specific to CPack Archive generator
45 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 .. variable:: CPACK_ARCHIVE_FILE_NAME
48 CPACK_ARCHIVE_<component>_FILE_NAME
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 Note that ``<component>`` is all uppercase in the variable name.
54 The default is ``<CPACK_PACKAGE_FILE_NAME>[-<component>]``, with spaces
58 Per-component ``CPACK_ARCHIVE_<component>_FILE_NAME`` variables.
60 .. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL
62 Enable component packaging. If enabled (ON), then the archive generator
63 creates multiple packages. The default is OFF, which means that a single
64 package containing files of all components is generated.
66 Variables used by CPack Archive generator
67 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69 These variables are used by the Archive generator, but are also available to
70 CPack generators which are essentially archives at their core. These include:
72 - :cpack_gen:`CPack Cygwin Generator`
73 - :cpack_gen:`CPack FreeBSD Generator`
75 .. variable:: CPACK_ARCHIVE_THREADS
77 .. versionadded:: 3.18
79 The number of threads to use when performing the compression. If set to
80 ``0``, the number of available cores on the machine will be used instead.
81 The default is ``1`` which limits compression to a single thread. Note that
82 not all compression modes support threading in all environments. Currently,
83 only the XZ compression may support it.
85 See also the :variable:`CPACK_THREADS` variable.
87 .. versionadded:: 3.21
89 Official CMake binaries available on ``cmake.org`` now ship
90 with a ``liblzma`` that supports parallel compression.
91 Older versions did not.