archive.rst 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. Variables used by CPack Archive generator
  64. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  65. These variables are used by the Archive generator, but are also available to
  66. CPack generators which are essentially archives at their core. These include:
  67. - :cpack_gen:`CPack Cygwin Generator`
  68. - :cpack_gen:`CPack FreeBSD Generator`
  69. .. variable:: CPACK_ARCHIVE_THREADS
  70. .. versionadded:: 3.18
  71. The number of threads to use when performing the compression.
  72. :Default: value of :variable:`CPACK_THREADS`
  73. If set to ``0``, the number of available cores on the machine will be used instead.
  74. Note that not all compression modes support threading in all environments.
  75. .. versionadded:: 3.21
  76. Official CMake binaries available on ``cmake.org`` now ship
  77. with a ``liblzma`` that supports parallel compression.
  78. Older versions did not.