external.rst 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. CPack External Generator
  2. ------------------------
  3. CPack provides many generators to create packages for a variety of platforms
  4. and packaging systems. The intention is for CMake/CPack to be a complete
  5. end-to-end solution for building and packaging a software project. However, it
  6. may not always be possible to use CPack for the entire packaging process, due
  7. to either technical limitations or policies that require the use of certain
  8. tools. For this reason, CPack provides the "External" generator, which allows
  9. external packaging software to take advantage of some of the functionality
  10. provided by CPack, such as component installation and the dependency graph.
  11. The CPack External generator doesn't actually package any files. Instead, it
  12. generates a .json file containing the CPack internal metadata, which gives
  13. external software information on how to package the software. This metadata
  14. file contains a list of CPack components and component groups, the various
  15. options passed to :command:`cpack_add_component` and
  16. :command:`cpack_add_component_group`, the dependencies between the components
  17. and component groups, and various other options passed to CPack.
  18. Format
  19. ^^^^^^
  20. The file produced by the CPack External generator is a .json file with an
  21. object as its root. This root object will always provide two fields:
  22. ``formatVersionMajor`` and ``formatVersionMinor``, which are always integers
  23. that describe the output format of the generator. Backwards-compatible changes
  24. to the output format (for example, adding a new field that didn't exist before)
  25. cause the minor version to be incremented, and backwards-incompatible changes
  26. (for example, deleting a field or changing its meaning) cause the major version
  27. to be incremented and the minor version reset to 0. The format version is
  28. always of the format ``major.minor``. In other words, it always has exactly two
  29. parts, separated by a period.
  30. You can request one or more specific versions of the output format as described
  31. below with :variable:`CPACK_EXT_REQUESTED_VERSIONS`. The output format will
  32. have a major version that exactly matches the requested major version, and a
  33. minor version that is greater than or equal to the requested minor version. If
  34. no version is requested with :variable:`CPACK_EXT_REQUESTED_VERSIONS`, the
  35. latest known major version is used by default. Currently, the only supported
  36. format is 1.0, which is described below.
  37. Version 1.0
  38. ***********
  39. In addition to the standard format fields, format version 1.0 provides the
  40. following fields in the root:
  41. ``components``
  42. The ``components`` field is an object with component names as the keys and
  43. objects describing the components as the values. The component objects have
  44. the following fields:
  45. ``name``
  46. The name of the component. This is always the same as the key in the
  47. ``components`` object.
  48. ``displayName``
  49. The value of the ``DISPLAY_NAME`` field passed to
  50. :command:`cpack_add_component`.
  51. ``description``
  52. The value of the ``DESCRIPTION`` field passed to
  53. :command:`cpack_add_component`.
  54. ``isHidden``
  55. True if ``HIDDEN`` was passed to :command:`cpack_add_component`, false if
  56. it was not.
  57. ``isRequired``
  58. True if ``REQUIRED`` was passed to :command:`cpack_add_component`, false if
  59. it was not.
  60. ``isDisabledByDefault``
  61. True if ``DISABLED`` was passed to :command:`cpack_add_component`, false if
  62. it was not.
  63. ``group``
  64. Only present if ``GROUP`` was passed to :command:`cpack_add_component`. If
  65. so, this field is a string value containing the component's group.
  66. ``dependencies``
  67. An array of components the component depends on. This contains the values
  68. in the ``DEPENDS`` argument passed to :command:`cpack_add_component`. If no
  69. ``DEPENDS`` argument was passed, this is an empty list.
  70. ``installationTypes``
  71. An array of installation types the component is part of. This contains the
  72. values in the ``INSTALL_TYPES`` argument passed to
  73. :command:`cpack_add_component`. If no ``INSTALL_TYPES`` argument was
  74. passed, this is an empty list.
  75. ``isDownloaded``
  76. True if ``DOWNLOADED`` was passed to :command:`cpack_add_component`, false
  77. if it was not.
  78. ``archiveFile``
  79. The name of the archive file passed with the ``ARCHIVE_FILE`` argument to
  80. :command:`cpack_add_component`. If no ``ARCHIVE_FILE`` argument was passed,
  81. this is an empty string.
  82. ``componentGroups``
  83. The ``componentGroups`` field is an object with component group names as the
  84. keys and objects describing the component groups as the values. The component
  85. group objects have the following fields:
  86. ``name``
  87. The name of the component group. This is always the same as the key in the
  88. ``componentGroups`` object.
  89. ``displayName``
  90. The value of the ``DISPLAY_NAME`` field passed to
  91. :command:`cpack_add_component_group`.
  92. ``description``
  93. The value of the ``DESCRIPTION`` field passed to
  94. :command:`cpack_add_component_group`.
  95. ``parentGroup``
  96. Only present if ``PARENT_GROUP`` was passed to
  97. :command:`cpack_add_component_group`. If so, this field is a string value
  98. containing the component group's parent group.
  99. ``isExpandedByDefault``
  100. True if ``EXPANDED`` was passed to :command:`cpack_add_component_group`,
  101. false if it was not.
  102. ``isBold``
  103. True if ``BOLD_TITLE`` was passed to :command:`cpack_add_component_group`,
  104. false if it was not.
  105. ``components``
  106. An array of names of components that are direct members of the group
  107. (components that have this group as their ``GROUP``). Components of
  108. subgroups are not included.
  109. ``subgroups``
  110. An array of names of component groups that are subgroups of the group
  111. (groups that have this group as their ``PARENT_GROUP``).
  112. ``installationTypes``
  113. The ``installationTypes`` field is an object with installation type names as
  114. the keys and objects describing the installation types as the values. The
  115. installation type objects have the following fields:
  116. ``name``
  117. The name of the installation type. This is always the same as the key in
  118. the ``installationTypes`` object.
  119. ``displayName``
  120. The value of the ``DISPLAY_NAME`` field passed to
  121. :command:`cpack_add_install_type`.
  122. ``index``
  123. The integer index of the installation type in the list.
  124. ``projects``
  125. The ``projects`` field is an array of objects describing CMake projects which
  126. comprise the CPack project. The values in this field are derived from
  127. :variable:`CPACK_INSTALL_CMAKE_PROJECTS`. In most cases, this will be only a
  128. single project. The project objects have the following fields:
  129. ``projectName``
  130. The project name passed to :variable:`CPACK_INSTALL_CMAKE_PROJECTS`.
  131. ``component``
  132. The name of the component or component set which comprises the project.
  133. ``directory``
  134. The build directory of the CMake project. This is the directory which
  135. contains the ``cmake_install.cmake`` script.
  136. ``subDirectory``
  137. The subdirectory to install the project into inside the CPack package.
  138. ``packageName``
  139. The package name given in :variable:`CPACK_PACKAGE_NAME`. Only present if
  140. this option is set.
  141. ``packageVersion``
  142. The package version given in :variable:`CPACK_PACKAGE_VERSION`. Only present
  143. if this option is set.
  144. ``packageDescriptionFile``
  145. The package description file given in
  146. :variable:`CPACK_PACKAGE_DESCRIPTION_FILE`. Only present if this option is
  147. set.
  148. ``packageDescriptionSummary``
  149. The package description summary given in
  150. :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`. Only present if this option is
  151. set.
  152. ``buildConfig``
  153. The build configuration given to CPack with the ``-C`` option. Only present
  154. if this option is set.
  155. ``defaultDirectoryPermissions``
  156. The default directory permissions given in
  157. :variable:`CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS`. Only present if this
  158. option is set.
  159. ``setDestdir``
  160. True if :variable:`CPACK_SET_DESTDIR` is true, false if it is not.
  161. ``packagingInstallPrefix``
  162. The install prefix given in :variable:`CPACK_PACKAGING_INSTALL_PREFIX`. Only
  163. present if :variable:`CPACK_SET_DESTDIR` is true.
  164. ``stripFiles``
  165. True if :variable:`CPACK_STRIP_FILES` is true, false if it is not.
  166. ``warnOnAbsoluteInstallDestination``
  167. True if :variable:`CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION` is true, false
  168. if it is not.
  169. ``errorOnAbsoluteInstallDestination``
  170. True if :variable:`CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION` is true,
  171. false if it is not.
  172. Variables specific to CPack External generator
  173. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  174. .. variable:: CPACK_EXT_REQUESTED_VERSIONS
  175. This variable is used to request a specific version of the CPack External
  176. generator. It is a list of ``major.minor`` values, separated by semicolons.
  177. If this variable is set to a non-empty value, the CPack External generator
  178. will iterate through each item in the list to search for a version that it
  179. knows how to generate. Requested versions should be listed in order of
  180. descending preference by the client software, as the first matching version
  181. in the list will be generated.
  182. The generator knows how to generate the version if it has a versioned
  183. generator whose major version exactly matches the requested major version,
  184. and whose minor version is greater than or equal to the requested minor
  185. version. For example, if ``CPACK_EXT_REQUESTED_VERSIONS`` contains 1.0, and
  186. the CPack External generator knows how to generate 1.1, it will generate 1.1.
  187. If the generator doesn't know how to generate a version in the list, it skips
  188. the version and looks at the next one. If it doesn't know how to generate any
  189. of the requested versions, an error is thrown.
  190. If this variable is not set, or is empty, the CPack External generator will
  191. generate the highest major and minor version that it knows how to generate.
  192. If an invalid version is encountered in ``CPACK_EXT_REQUESTED_VERSIONS`` (one
  193. that doesn't match ``major.minor``, where ``major`` and ``minor`` are
  194. integers), it is ignored.