archive.rst 3.0 KB

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