archive.rst 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.
  40. :Default: The default is ``<CPACK_PACKAGE_FILE_NAME>[-<component>]``, with spaces
  41. replaced by '-'.
  42. The extension is determined from the archive format (see list above) and
  43. automatically appended to the file name. Note that ``<component>`` is all
  44. uppercase in the variable name.
  45. .. versionadded:: 3.9
  46. Per-component :variable:`!CPACK_ARCHIVE_<component>_FILE_NAME` variables.
  47. .. variable:: CPACK_ARCHIVE_FILE_EXTENSION
  48. .. versionadded:: 3.25
  49. Package file extension.
  50. :Default: Default values are given in the list above.
  51. .. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL
  52. Enable component packaging.
  53. :Default: ``OFF``
  54. If enabled (``ON``) multiple packages are generated. By default a single package
  55. containing files of all components is generated.
  56. Variables used by CPack Archive generator
  57. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  58. These variables are used by the Archive generator, but are also available to
  59. CPack generators which are essentially archives at their core. These include:
  60. - :cpack_gen:`CPack Cygwin Generator`
  61. - :cpack_gen:`CPack FreeBSD Generator`
  62. .. variable:: CPACK_ARCHIVE_THREADS
  63. The number of threads to use when performing the compression.
  64. .. versionadded:: 3.18
  65. :Default: value of :variable:`CPACK_THREADS`
  66. If set to ``0``, the number of available cores on the machine will be used instead.
  67. Note that not all compression modes support threading in all environments.
  68. .. versionadded:: 3.21
  69. Official CMake binaries available on ``cmake.org`` now ship
  70. with a ``liblzma`` that supports parallel compression.
  71. Older versions did not.