archive.rst 2.8 KB

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