archive.rst 3.7 KB

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