cmake/Help/cpack_gen/archive.rst

108 lines
3.1 KiB
ReStructuredText
Raw Normal View History

2018-10-28 12:09:07 +01:00
CPack Archive Generator
-----------------------
2020-08-30 11:54:41 +02:00
CPack generator for packaging files into an archive, which can have
any of the following formats:
2018-10-28 12:09:07 +01:00
2023-05-23 16:38:00 +02:00
- 7Z - 7zip - (``.7z``)
- TBZ2 (``.tar.bz2``)
- TGZ (``.tar.gz``)
- TXZ (``.tar.xz``)
- TZ (``.tar.Z``)
- TZST (``.tar.zst``)
- ZIP (``.zip``)
2018-10-28 12:09:07 +01:00
2021-09-14 00:13:48 +02:00
.. versionadded:: 3.1
2023-05-23 16:38:00 +02:00
7Z and TXZ formats support.
2021-09-14 00:13:48 +02:00
.. versionadded:: 3.16
2023-05-23 16:38:00 +02:00
TZST format support.
2021-09-14 00:13:48 +02:00
2020-08-30 11:54:41 +02:00
When this generator is called from ``CPackSourceConfig.cmake`` (or through
the ``package_source`` target), then the generated archive will contain all
files in the project directory, except those specified in
:variable:`CPACK_SOURCE_IGNORE_FILES`. The following is one example of
packaging all source files of a project:
.. code-block:: cmake
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES
\\.git/
build/
".*~$"
)
set(CPACK_VERBATIM_VARIABLES YES)
include(CPack)
When this generator is called from ``CPackConfig.cmake`` (or through the
``package`` target), then the generated archive will contain all files
that have been installed via CMake's :command:`install` command (and the
deprecated commands :command:`install_files`, :command:`install_programs`,
and :command:`install_targets`).
2018-10-28 12:09:07 +01:00
Variables specific to CPack Archive generator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. variable:: CPACK_ARCHIVE_FILE_NAME
CPACK_ARCHIVE_<component>_FILE_NAME
2023-05-23 16:38:00 +02:00
Package file name without extension.
2022-08-04 22:12:04 +02:00
2023-05-23 16:38:00 +02:00
:Default: The default is ``<CPACK_PACKAGE_FILE_NAME>[-<component>]``, with spaces
replaced by '-'.
The extension is determined from the archive format (see list above) and
automatically appended to the file name. Note that ``<component>`` is all
uppercase in the variable name.
2018-10-28 12:09:07 +01:00
2021-09-14 00:13:48 +02:00
.. versionadded:: 3.9
2023-05-23 16:38:00 +02:00
Per-component :variable:`!CPACK_ARCHIVE_<component>_FILE_NAME` variables.
2021-09-14 00:13:48 +02:00
2022-11-16 20:14:03 +01:00
.. variable:: CPACK_ARCHIVE_FILE_EXTENSION
.. versionadded:: 3.25
2023-05-23 16:38:00 +02:00
Package file extension.
:Default: Default values are given in the list above.
2022-11-16 20:14:03 +01:00
2018-10-28 12:09:07 +01:00
.. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL
2023-05-23 16:38:00 +02:00
Enable component packaging.
:Default: ``OFF``
If enabled (``ON``) multiple packages are generated. By default a single package
containing files of all components is generated.
2020-08-30 11:54:41 +02:00
Variables used by CPack Archive generator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
These variables are used by the Archive generator, but are also available to
CPack generators which are essentially archives at their core. These include:
2023-05-23 16:38:00 +02:00
- :cpack_gen:`CPack Cygwin Generator`
- :cpack_gen:`CPack FreeBSD Generator`
2020-08-30 11:54:41 +02:00
.. variable:: CPACK_ARCHIVE_THREADS
2023-05-23 16:38:00 +02:00
The number of threads to use when performing the compression.
2021-09-14 00:13:48 +02:00
.. versionadded:: 3.18
2023-05-23 16:38:00 +02:00
:Default: ``1``
If set to ``0``, the number of available cores on the machine will be used instead.
2020-08-30 11:54:41 +02:00
The default is ``1`` which limits compression to a single thread. Note that
not all compression modes support threading in all environments. Currently,
only the XZ compression may support it.
2018-10-28 12:09:07 +01:00
2021-09-14 00:13:48 +02:00
See also the :variable:`CPACK_THREADS` variable.
.. versionadded:: 3.21
2018-10-28 12:09:07 +01:00
2021-09-14 00:13:48 +02:00
Official CMake binaries available on ``cmake.org`` now ship
with a ``liblzma`` that supports parallel compression.
Older versions did not.