cmake-presets.7.rst 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276
  1. .. cmake-manual-description: CMakePresets.json
  2. cmake-presets(7)
  3. ****************
  4. .. only:: html
  5. .. contents::
  6. Introduction
  7. ============
  8. .. versionadded:: 3.19
  9. One problem that CMake users often face is sharing settings with other people
  10. for common ways to configure a project. This may be done to support CI builds,
  11. or for users who frequently use the same build. CMake supports two main files,
  12. ``CMakePresets.json`` and ``CMakeUserPresets.json``, that allow users to
  13. specify common configure options and share them with others. CMake also
  14. supports files included with the ``include`` field.
  15. ``CMakePresets.json`` and ``CMakeUserPresets.json`` live in the project's root
  16. directory. They both have exactly the same format, and both are optional
  17. (though at least one must be present if :option:`--preset <cmake --preset>`
  18. is specified). ``CMakePresets.json`` is meant to specify project-wide build
  19. details, while ``CMakeUserPresets.json`` is meant for developers to specify
  20. their own local build details.
  21. ``CMakePresets.json`` may be checked into a version control system, and
  22. ``CMakeUserPresets.json`` should NOT be checked in. For example, if a
  23. project is using Git, ``CMakePresets.json`` may be tracked, and
  24. ``CMakeUserPresets.json`` should be added to the ``.gitignore``.
  25. Format
  26. ======
  27. The files are a JSON document with an object as the root:
  28. .. literalinclude:: presets/example.json
  29. :language: json
  30. The root object recognizes the following fields:
  31. ``$schema``
  32. An optional string that provides a URI to the JSON schema that describes the
  33. structure of this JSON document. This field is used for validation and
  34. autocompletion in editors that support JSON schema. It doesn't affect the
  35. behavior of the document itself. If this field is not specified, the JSON
  36. document will still be valid, but tools that use JSON schema for validation
  37. and autocompletion may not function correctly.
  38. This is allowed in preset files specifying version ``8`` or above.
  39. ``version``
  40. A required integer representing the version of the JSON schema.
  41. The supported versions are:
  42. ``1``
  43. .. versionadded:: 3.19
  44. ``2``
  45. .. versionadded:: 3.20
  46. ``3``
  47. .. versionadded:: 3.21
  48. ``4``
  49. .. versionadded:: 3.23
  50. ``5``
  51. .. versionadded:: 3.24
  52. ``6``
  53. .. versionadded:: 3.25
  54. ``7``
  55. .. versionadded:: 3.27
  56. ``cmakeMinimumRequired``
  57. An optional object representing the minimum version of CMake needed to
  58. build this project. This object consists of the following fields:
  59. ``major``
  60. An optional integer representing the major version.
  61. ``minor``
  62. An optional integer representing the minor version.
  63. ``patch``
  64. An optional integer representing the patch version.
  65. ``include``
  66. An optional array of strings representing files to include. If the filenames
  67. are not absolute, they are considered relative to the current file.
  68. This is allowed in preset files specifying version ``4`` or above.
  69. See `Includes`_ for discussion of the constraints on included files.
  70. ``vendor``
  71. An optional map containing vendor-specific information. CMake does not
  72. interpret the contents of this field except to verify that it is a map if
  73. it does exist. However, the keys should be a vendor-specific domain name
  74. followed by a ``/``-separated path. For example, the Example IDE 1.0 could
  75. use ``example.com/ExampleIDE/1.0``. The value of each field can be anything
  76. desired by the vendor, though will typically be a map.
  77. ``configurePresets``
  78. An optional array of `Configure Preset`_ objects.
  79. This is allowed in preset files specifying version ``1`` or above.
  80. ``buildPresets``
  81. An optional array of `Build Preset`_ objects.
  82. This is allowed in preset files specifying version ``2`` or above.
  83. ``testPresets``
  84. An optional array of `Test Preset`_ objects.
  85. This is allowed in preset files specifying version ``2`` or above.
  86. ``packagePresets``
  87. An optional array of `Package Preset`_ objects.
  88. This is allowed in preset files specifying version ``6`` or above.
  89. ``workflowPresets``
  90. An optional array of `Workflow Preset`_ objects.
  91. This is allowed in preset files specifying version ``6`` or above.
  92. Includes
  93. ^^^^^^^^
  94. ``CMakePresets.json`` and ``CMakeUserPresets.json`` can include other files
  95. with the ``include`` field in file version ``4`` and later. Files included
  96. by these files can also include other files. If ``CMakePresets.json`` and
  97. ``CMakeUserPresets.json`` are both present, ``CMakeUserPresets.json``
  98. implicitly includes ``CMakePresets.json``, even with no ``include`` field,
  99. in all versions of the format.
  100. If a preset file contains presets that inherit from presets in another file,
  101. the file must include the other file either directly or indirectly.
  102. Include cycles are not allowed among files. If ``a.json`` includes
  103. ``b.json``, ``b.json`` cannot include ``a.json``. However, a file may be
  104. included multiple times from the same file or from different files.
  105. Files directly or indirectly included from ``CMakePresets.json`` should be
  106. guaranteed to be provided by the project. ``CMakeUserPresets.json`` may
  107. include files from anywhere.
  108. Starting from version ``7``, the ``include`` field supports
  109. `macro expansion`_, but only ``$penv{}`` macro expansion.
  110. Configure Preset
  111. ^^^^^^^^^^^^^^^^
  112. Each entry of the ``configurePresets`` array is a JSON object
  113. that may contain the following fields:
  114. ``name``
  115. A required string representing the machine-friendly name of the preset.
  116. This identifier is used in the :ref:`cmake --preset <CMake Options>` option.
  117. There must not be two configure presets in the union of ``CMakePresets.json``
  118. and ``CMakeUserPresets.json`` in the same directory with the same name.
  119. However, a configure preset may have the same name as a build, test,
  120. package, or workflow preset.
  121. ``hidden``
  122. An optional boolean specifying whether or not a preset should be hidden.
  123. If a preset is hidden, it cannot be used in the ``--preset=`` argument,
  124. will not show up in the :manual:`CMake GUI <cmake-gui(1)>`, and does not
  125. have to have a valid ``generator`` or ``binaryDir``, even from
  126. inheritance. ``hidden`` presets are intended to be used as a base for
  127. other presets to inherit via the ``inherits`` field.
  128. ``inherits``
  129. An optional array of strings representing the names of presets to inherit
  130. from. This field can also be a string, which is equivalent to an array
  131. containing one string.
  132. The preset will inherit all of the fields from the ``inherits``
  133. presets by default (except ``name``, ``hidden``, ``inherits``,
  134. ``description``, and ``displayName``), but can override them as
  135. desired. If multiple ``inherits`` presets provide conflicting values for
  136. the same field, the earlier preset in the ``inherits`` array will be
  137. preferred.
  138. A preset can only inherit from another preset that is defined in the
  139. same file or in one of the files it includes (directly or indirectly).
  140. Presets in ``CMakePresets.json`` may not inherit from presets in
  141. ``CMakeUserPresets.json``.
  142. ``condition``
  143. An optional `Condition`_ object. This is allowed in preset files specifying
  144. version ``3`` or above.
  145. ``vendor``
  146. An optional map containing vendor-specific information. CMake does not
  147. interpret the contents of this field except to verify that it is a map
  148. if it does exist. However, it should follow the same conventions as the
  149. root-level ``vendor`` field. If vendors use their own per-preset
  150. ``vendor`` field, they should implement inheritance in a sensible manner
  151. when appropriate.
  152. ``displayName``
  153. An optional string with a human-friendly name of the preset.
  154. ``description``
  155. An optional string with a human-friendly description of the preset.
  156. ``generator``
  157. An optional string representing the generator to use for the preset. If
  158. ``generator`` is not specified, it must be inherited from the
  159. ``inherits`` preset (unless this preset is ``hidden``). In version ``3``
  160. or above, this field may be omitted to fall back to regular generator
  161. discovery procedure.
  162. Note that for Visual Studio generators, unlike in the command line
  163. :option:`-G <cmake -G>` argument, you cannot include the platform name
  164. in the generator name. Use the ``architecture`` field instead.
  165. ``architecture``, ``toolset``
  166. Optional fields representing the platform and toolset, respectively, for
  167. :manual:`generators <cmake-generators(7)>` that support them.
  168. See :option:`cmake -A` option for possible values for ``architecture``
  169. and :option:`cmake -T` for ``toolset``.
  170. Each may be either a string or an object with the following fields:
  171. ``value``
  172. An optional string representing the value.
  173. ``strategy``
  174. An optional string telling CMake how to handle the ``architecture`` or
  175. ``toolset`` field. Valid values are:
  176. ``"set"``
  177. Set the respective value. This will result in an error for generators
  178. that do not support the respective field.
  179. ``"external"``
  180. Do not set the value, even if the generator supports it. This is
  181. useful if, for example, a preset uses the Ninja generator, and an IDE
  182. knows how to set up the Visual C++ environment from the
  183. ``architecture`` and ``toolset`` fields. In that case, CMake will
  184. ignore the field, but the IDE can use them to set up the environment
  185. before invoking CMake.
  186. If no ``strategy`` field is given, or if the field uses the string form
  187. rather than the object form, the behavior is the same as ``"set"``.
  188. ``toolchainFile``
  189. An optional string representing the path to the toolchain file.
  190. This field supports `macro expansion`_. If a relative path is specified,
  191. it is calculated relative to the build directory, and if not found,
  192. relative to the source directory. This field takes precedence over any
  193. :variable:`CMAKE_TOOLCHAIN_FILE` value. It is allowed in preset files
  194. specifying version ``3`` or above.
  195. ``binaryDir``
  196. An optional string representing the path to the output binary directory.
  197. This field supports `macro expansion`_. If a relative path is specified,
  198. it is calculated relative to the source directory. If ``binaryDir`` is not
  199. specified, it must be inherited from the ``inherits`` preset (unless this
  200. preset is ``hidden``). In version ``3`` or above, this field may be
  201. omitted.
  202. ``installDir``
  203. An optional string representing the path to the installation directory.
  204. This field supports `macro expansion`_. If a relative path is specified,
  205. it is calculated relative to the source directory. This is allowed in
  206. preset files specifying version ``3`` or above.
  207. ``cmakeExecutable``
  208. An optional string representing the path to the CMake executable to use
  209. for this preset. This is reserved for use by IDEs, and is not used by
  210. CMake itself. IDEs that use this field should expand any macros in it.
  211. ``cacheVariables``
  212. An optional map of cache variables. The key is the variable name (which
  213. may not be an empty string), and the value is either ``null``, a boolean
  214. (which is equivalent to a value of ``"TRUE"`` or ``"FALSE"`` and a type
  215. of ``BOOL``), a string representing the value of the variable (which
  216. supports `macro expansion`_), or an object with the following fields:
  217. ``type``
  218. An optional string representing the type of the variable.
  219. ``value``
  220. A required string or boolean representing the value of the variable.
  221. A boolean is equivalent to ``"TRUE"`` or ``"FALSE"``. This field
  222. supports `macro expansion`_.
  223. Cache variables are inherited through the ``inherits`` field, and the
  224. preset's variables will be the union of its own ``cacheVariables`` and
  225. the ``cacheVariables`` from all its parents. If multiple presets in this
  226. union define the same variable, the standard rules of ``inherits`` are
  227. applied. Setting a variable to ``null`` causes it to not be set, even if
  228. a value was inherited from another preset.
  229. ``environment``
  230. An optional map of environment variables. The key is the variable name
  231. (which may not be an empty string), and the value is either ``null`` or
  232. a string representing the value of the variable. Each variable is set
  233. regardless of whether or not a value was given to it by the process's
  234. environment. This field supports `macro expansion`_, and environment
  235. variables in this map may reference each other, and may be listed in any
  236. order, as long as such references do not cause a cycle (for example,
  237. if ``ENV_1`` is ``$env{ENV_2}``, ``ENV_2`` may not be ``$env{ENV_1}``.)
  238. Environment variables are inherited through the ``inherits`` field, and
  239. the preset's environment will be the union of its own ``environment`` and
  240. the ``environment`` from all its parents. If multiple presets in this
  241. union define the same variable, the standard rules of ``inherits`` are
  242. applied. Setting a variable to ``null`` causes it to not be set, even if
  243. a value was inherited from another preset.
  244. ``warnings``
  245. An optional object specifying the warnings to enable. The object may
  246. contain the following fields:
  247. ``dev``
  248. An optional boolean. Equivalent to passing :option:`-Wdev <cmake -Wdev>`
  249. or :option:`-Wno-dev <cmake -Wno-dev>` on the command line. This may not
  250. be set to ``false`` if ``errors.dev`` is set to ``true``.
  251. ``deprecated``
  252. An optional boolean. Equivalent to passing
  253. :option:`-Wdeprecated <cmake -Wdeprecated>` or
  254. :option:`-Wno-deprecated <cmake -Wno-deprecated>` on the command line.
  255. This may not be set to ``false`` if ``errors.deprecated`` is set to
  256. ``true``.
  257. ``uninitialized``
  258. An optional boolean. Setting this to ``true`` is equivalent to passing
  259. :option:`--warn-uninitialized <cmake --warn-uninitialized>` on the command
  260. line.
  261. ``unusedCli``
  262. An optional boolean. Setting this to ``false`` is equivalent to passing
  263. :option:`--no-warn-unused-cli <cmake --no-warn-unused-cli>` on the command
  264. line.
  265. ``systemVars``
  266. An optional boolean. Setting this to ``true`` is equivalent to passing
  267. :option:`--check-system-vars <cmake --check-system-vars>` on the command
  268. line.
  269. ``errors``
  270. An optional object specifying the errors to enable. The object may
  271. contain the following fields:
  272. ``dev``
  273. An optional boolean. Equivalent to passing :option:`-Werror=dev <cmake -Werror>`
  274. or :option:`-Wno-error=dev <cmake -Werror>` on the command line.
  275. This may not be set to ``true`` if ``warnings.dev`` is set to ``false``.
  276. ``deprecated``
  277. An optional boolean. Equivalent to passing
  278. :option:`-Werror=deprecated <cmake -Werror>` or
  279. :option:`-Wno-error=deprecated <cmake -Werror>` on the command line.
  280. This may not be set to ``true`` if ``warnings.deprecated`` is set to
  281. ``false``.
  282. ``debug``
  283. An optional object specifying debug options. The object may contain the
  284. following fields:
  285. ``output``
  286. An optional boolean. Setting this to ``true`` is equivalent to passing
  287. :option:`--debug-output <cmake --debug-output>` on the command line.
  288. ``tryCompile``
  289. An optional boolean. Setting this to ``true`` is equivalent to passing
  290. :option:`--debug-trycompile <cmake --debug-trycompile>` on the command
  291. line.
  292. ``find``
  293. An optional boolean. Setting this to ``true`` is equivalent to passing
  294. :option:`--debug-find <cmake --debug-find>` on the command line.
  295. ``trace``
  296. An optional object specifying trace options. This is allowed in preset
  297. files specifying version ``7``. The object may contain the following fields:
  298. ``mode``
  299. An optional string that specifies the trace mode. Valid values are:
  300. ``on``
  301. Causes a trace of all calls made and from where to be printed.
  302. Equivalent to passing :option:`--trace <cmake --trace>` on the command
  303. line.
  304. ``off``
  305. A trace of all calls will not be printed.
  306. ``expand``
  307. Causes a trace with variables expanded of all calls made and from where
  308. to be printed. Equivalent to passing :option:`--trace-expand <cmake --trace-expand>`
  309. on the command line.
  310. ``format``
  311. An optional string that specifies the format output of the trace.
  312. Valid values are:
  313. ``human``
  314. Prints each trace line in a human-readable format.
  315. This is the default format. Equivalent to passing
  316. :option:`--trace-format=human <cmake --trace-format>`
  317. on the command line.
  318. ``json-v1``
  319. Prints each line as a separate JSON document. Equivalent to passing
  320. :option:`--trace-format=json-v1 <cmake --trace-format>`
  321. on the command line.
  322. ``source``
  323. An optional array of strings representing the paths of source files to
  324. be traced. This field can also be a string, which is equivalent to an
  325. array containing one string. Equivalent to passing
  326. :option:`--trace-source <cmake --trace-source>` on the command line.
  327. ``redirect``
  328. An optional string specifying a path to a trace output file. Equivalent
  329. to passing :option:`--trace-redirect <cmake --trace-redirect>`
  330. on the command line.
  331. Build Preset
  332. ^^^^^^^^^^^^
  333. Each entry of the ``buildPresets`` array is a JSON object
  334. that may contain the following fields:
  335. ``name``
  336. A required string representing the machine-friendly name of the preset.
  337. This identifier is used in the
  338. :ref:`cmake --build --preset <Build Tool Mode>` option.
  339. There must not be two build presets in the union of ``CMakePresets.json``
  340. and ``CMakeUserPresets.json`` in the same directory with the same name.
  341. However, a build preset may have the same name as a configure, test,
  342. package, or workflow preset.
  343. ``hidden``
  344. An optional boolean specifying whether or not a preset should be hidden.
  345. If a preset is hidden, it cannot be used in the
  346. :option:`--preset <cmake --preset>` argument
  347. and does not have to have a valid ``configurePreset``, even from
  348. inheritance. ``hidden`` presets are intended to be used as a base for
  349. other presets to inherit via the ``inherits`` field.
  350. ``inherits``
  351. An optional array of strings representing the names of presets to inherit
  352. from. This field can also be a string, which is equivalent to an array
  353. containing one string.
  354. The preset will inherit all of the fields from the
  355. ``inherits`` presets by default (except ``name``, ``hidden``,
  356. ``inherits``, ``description``, and ``displayName``), but can override
  357. them as desired. If multiple ``inherits`` presets provide conflicting
  358. values for the same field, the earlier preset in the ``inherits`` array
  359. will be preferred.
  360. A preset can only inherit from another preset that is defined in the
  361. same file or in one of the files it includes (directly or indirectly).
  362. Presets in ``CMakePresets.json`` may not inherit from presets in
  363. ``CMakeUserPresets.json``.
  364. ``condition``
  365. An optional `Condition`_ object. This is allowed in preset files specifying
  366. version ``3`` or above.
  367. ``vendor``
  368. An optional map containing vendor-specific information. CMake does not
  369. interpret the contents of this field except to verify that it is a map
  370. if it does exist. However, it should follow the same conventions as the
  371. root-level ``vendor`` field. If vendors use their own per-preset
  372. ``vendor`` field, they should implement inheritance in a sensible manner
  373. when appropriate.
  374. ``displayName``
  375. An optional string with a human-friendly name of the preset.
  376. ``description``
  377. An optional string with a human-friendly description of the preset.
  378. ``environment``
  379. An optional map of environment variables. The key is the variable name
  380. (which may not be an empty string), and the value is either ``null`` or
  381. a string representing the value of the variable. Each variable is set
  382. regardless of whether or not a value was given to it by the process's
  383. environment. This field supports macro expansion, and environment
  384. variables in this map may reference each other, and may be listed in any
  385. order, as long as such references do not cause a cycle (for example, if
  386. ``ENV_1`` is ``$env{ENV_2}``, ``ENV_2`` may not be ``$env{ENV_1}``.)
  387. Environment variables are inherited through the ``inherits`` field, and
  388. the preset's environment will be the union of its own ``environment``
  389. and the ``environment`` from all its parents. If multiple presets in
  390. this union define the same variable, the standard rules of ``inherits``
  391. are applied. Setting a variable to ``null`` causes it to not be set,
  392. even if a value was inherited from another preset.
  393. .. note::
  394. For a CMake project using ExternalProject with a configuration preset
  395. having environment variables needed in the ExternalProject, use a build
  396. preset that inherits that configuration preset or the ExternalProject
  397. will not have the environment variables set in the configuration preset.
  398. Example: suppose the host defaults to one compiler (say Clang)
  399. and the user wishes to use another compiler (say GCC). Set configuration
  400. preset environment variables ``CC`` and ``CXX`` and use a build preset
  401. that inherits that configuration preset. Otherwise the ExternalProject
  402. may use a different (system default) compiler than the top-level CMake
  403. project.
  404. ``configurePreset``
  405. An optional string specifying the name of a configure preset to
  406. associate with this build preset. If ``configurePreset`` is not
  407. specified, it must be inherited from the inherits preset (unless this
  408. preset is hidden). The build directory is inferred from the configure
  409. preset, so the build will take place in the same ``binaryDir`` that the
  410. configuration did.
  411. ``inheritConfigureEnvironment``
  412. An optional boolean that defaults to true. If true, the environment
  413. variables from the associated configure preset are inherited after all
  414. inherited build preset environments, but before environment variables
  415. explicitly specified in this build preset.
  416. ``jobs``
  417. An optional integer. Equivalent to passing
  418. :option:`--parallel <cmake--build --parallel>` or ``-j`` on the command line.
  419. ``targets``
  420. An optional string or array of strings. Equivalent to passing
  421. :option:`--target <cmake--build --target>` or ``-t`` on the command line.
  422. Vendors may ignore the targets property or hide build presets that
  423. explicitly specify targets. This field supports macro expansion.
  424. ``configuration``
  425. An optional string. Equivalent to passing
  426. :option:`--config <cmake--build --config>` on the command line.
  427. ``cleanFirst``
  428. An optional bool. If true, equivalent to passing
  429. :option:`--clean-first <cmake--build --clean-first>` on the command line.
  430. ``resolvePackageReferences``
  431. An optional string that specifies the package resolve mode. This is
  432. allowed in preset files specifying version ``4`` or above.
  433. Package references are used to define dependencies to packages from
  434. external package managers. Currently only NuGet in combination with the
  435. Visual Studio generator is supported. If there are no targets that define
  436. package references, this option does nothing. Valid values are:
  437. ``on``
  438. Causes package references to be resolved before attempting a build.
  439. ``off``
  440. Package references will not be resolved. Note that this may cause
  441. errors in some build environments, such as .NET SDK style projects.
  442. ``only``
  443. Only resolve package references, but do not perform a build.
  444. .. note::
  445. The command line parameter
  446. :option:`--resolve-package-references <cmake--build --resolve-package-references>`
  447. will take priority over this setting. If the command line parameter is not
  448. provided and this setting is not specified, an environment-specific cache
  449. variable will be evaluated to decide, if package restoration should be
  450. performed.
  451. When using the Visual Studio generator, package references are defined
  452. using the :prop_tgt:`VS_PACKAGE_REFERENCES` property. Package references
  453. are restored using NuGet. It can be disabled by setting the
  454. ``CMAKE_VS_NUGET_PACKAGE_RESTORE`` variable to ``OFF``. This can also be
  455. done from within a configure preset.
  456. ``verbose``
  457. An optional bool. If true, equivalent to passing
  458. :option:`--verbose <cmake--build --verbose>` on the command line.
  459. ``nativeToolOptions``
  460. An optional array of strings. Equivalent to passing options after ``--``
  461. on the command line. The array values support macro expansion.
  462. Test Preset
  463. ^^^^^^^^^^^
  464. Each entry of the ``testPresets`` array is a JSON object
  465. that may contain the following fields:
  466. ``name``
  467. A required string representing the machine-friendly name of the preset.
  468. This identifier is used in the :option:`ctest --preset` option.
  469. There must not be two test presets in the union of ``CMakePresets.json``
  470. and ``CMakeUserPresets.json`` in the same directory with the same name.
  471. However, a test preset may have the same name as a configure, build,
  472. package, or workflow preset.
  473. ``hidden``
  474. An optional boolean specifying whether or not a preset should be hidden.
  475. If a preset is hidden, it cannot be used in the
  476. :option:`--preset <ctest --preset>` argument
  477. and does not have to have a valid ``configurePreset``, even from
  478. inheritance. ``hidden`` presets are intended to be used as a base for
  479. other presets to inherit via the ``inherits`` field.
  480. ``inherits``
  481. An optional array of strings representing the names of presets to inherit
  482. from. This field can also be a string, which is equivalent to an array
  483. containing one string.
  484. The preset will inherit all of the fields from the
  485. ``inherits`` presets by default (except ``name``, ``hidden``,
  486. ``inherits``, ``description``, and ``displayName``), but can override
  487. them as desired. If multiple ``inherits`` presets provide conflicting
  488. values for the same field, the earlier preset in the ``inherits`` array
  489. will be preferred.
  490. A preset can only inherit from another preset that is defined in the
  491. same file or in one of the files it includes (directly or indirectly).
  492. Presets in ``CMakePresets.json`` may not inherit from presets in
  493. ``CMakeUserPresets.json``.
  494. ``condition``
  495. An optional `Condition`_ object. This is allowed in preset files specifying
  496. version ``3`` or above.
  497. ``vendor``
  498. An optional map containing vendor-specific information. CMake does not
  499. interpret the contents of this field except to verify that it is a map
  500. if it does exist. However, it should follow the same conventions as the
  501. root-level ``vendor`` field. If vendors use their own per-preset
  502. ``vendor`` field, they should implement inheritance in a sensible manner
  503. when appropriate.
  504. ``displayName``
  505. An optional string with a human-friendly name of the preset.
  506. ``description``
  507. An optional string with a human-friendly description of the preset.
  508. ``environment``
  509. An optional map of environment variables. The key is the variable name
  510. (which may not be an empty string), and the value is either ``null`` or
  511. a string representing the value of the variable. Each variable is set
  512. regardless of whether or not a value was given to it by the process's
  513. environment. This field supports macro expansion, and environment
  514. variables in this map may reference each other, and may be listed in any
  515. order, as long as such references do not cause a cycle (for example, if
  516. ``ENV_1`` is ``$env{ENV_2}``, ``ENV_2`` may not be ``$env{ENV_1}``.)
  517. Environment variables are inherited through the ``inherits`` field, and
  518. the preset's environment will be the union of its own ``environment``
  519. and the ``environment`` from all its parents. If multiple presets in
  520. this union define the same variable, the standard rules of ``inherits``
  521. are applied. Setting a variable to ``null`` causes it to not be set,
  522. even if a value was inherited from another preset.
  523. ``configurePreset``
  524. An optional string specifying the name of a configure preset to
  525. associate with this test preset. If ``configurePreset`` is not
  526. specified, it must be inherited from the inherits preset (unless this
  527. preset is hidden). The build directory is inferred from the configure
  528. preset, so tests will run in the same ``binaryDir`` that the
  529. configuration did and build did.
  530. ``inheritConfigureEnvironment``
  531. An optional boolean that defaults to true. If true, the environment
  532. variables from the associated configure preset are inherited after all
  533. inherited test preset environments, but before environment variables
  534. explicitly specified in this test preset.
  535. ``configuration``
  536. An optional string. Equivalent to passing
  537. :option:`--build-config <ctest --build-config>` on the command line.
  538. ``overwriteConfigurationFile``
  539. An optional array of configuration options to overwrite options
  540. specified in the CTest configuration file. Equivalent to passing
  541. :option:`--overwrite <ctest --overwrite>` for each value in the array.
  542. The array values support macro expansion.
  543. ``output``
  544. An optional object specifying output options. The object may contain the
  545. following fields.
  546. ``shortProgress``
  547. An optional bool. If true, equivalent to passing
  548. :option:`--progress <ctest --progress>` on the command line.
  549. ``verbosity``
  550. An optional string specifying verbosity level. Must be one of the
  551. following:
  552. ``default``
  553. Equivalent to passing no verbosity flags on the command line.
  554. ``verbose``
  555. Equivalent to passing :option:`--verbose <ctest --verbose>` on
  556. the command line.
  557. ``extra``
  558. Equivalent to passing :option:`--extra-verbose <ctest --extra-verbose>`
  559. on the command line.
  560. ``debug``
  561. An optional bool. If true, equivalent to passing
  562. :option:`--debug <ctest --debug>` on the command line.
  563. ``outputOnFailure``
  564. An optional bool. If true, equivalent to passing
  565. :option:`--output-on-failure <ctest --output-on-failure>` on the command
  566. line.
  567. ``quiet``
  568. An optional bool. If true, equivalent to passing
  569. :option:`--quiet <ctest --quiet>` on the command line.
  570. ``outputLogFile``
  571. An optional string specifying a path to a log file. Equivalent to
  572. passing :option:`--output-log <ctest --output-log>` on the command line.
  573. This field supports macro expansion.
  574. ``outputJUnitFile``
  575. An optional string specifying a path to a JUnit file. Equivalent to
  576. passing :option:`--output-junit <ctest --output-junit>` on the command line.
  577. This field supports macro expansion. This is allowed in preset files
  578. specifying version ``6`` or above.
  579. ``labelSummary``
  580. An optional bool. If false, equivalent to passing
  581. :option:`--no-label-summary <ctest --no-label-summary>` on the command
  582. line.
  583. ``subprojectSummary``
  584. An optional bool. If false, equivalent to passing
  585. :option:`--no-subproject-summary <ctest --no-subproject-summary>`
  586. on the command line.
  587. ``maxPassedTestOutputSize``
  588. An optional integer specifying the maximum output for passed tests in
  589. bytes. Equivalent to passing
  590. :option:`--test-output-size-passed <ctest --test-output-size-passed>`
  591. on the command line.
  592. ``maxFailedTestOutputSize``
  593. An optional integer specifying the maximum output for failed tests in
  594. bytes. Equivalent to passing
  595. :option:`--test-output-size-failed <ctest --test-output-size-failed>`
  596. on the command line.
  597. ``testOutputTruncation``
  598. An optional string specifying the test output truncation mode. Equivalent
  599. to passing
  600. :option:`--test-output-truncation <ctest --test-output-truncation>` on
  601. the command line. This is allowed in preset files specifying version
  602. ``5`` or above.
  603. ``maxTestNameWidth``
  604. An optional integer specifying the maximum width of a test name to
  605. output. Equivalent to passing :option:`--max-width <ctest --max-width>`
  606. on the command line.
  607. ``filter``
  608. An optional object specifying how to filter the tests to run. The object
  609. may contain the following fields.
  610. ``include``
  611. An optional object specifying which tests to include. The object may
  612. contain the following fields.
  613. ``name``
  614. An optional string specifying a regex for test names. Equivalent to
  615. passing :option:`--tests-regex <ctest --tests-regex>` on the command
  616. line. This field supports macro expansion. CMake regex syntax is
  617. described under :ref:`string(REGEX) <Regex Specification>`.
  618. ``label``
  619. An optional string specifying a regex for test labels. Equivalent to
  620. passing :option:`--label-regex <ctest --label-regex>` on the command
  621. line. This field supports macro expansion.
  622. ``useUnion``
  623. An optional bool. Equivalent to passing :option:`--union <ctest --union>`
  624. on the command line.
  625. ``index``
  626. An optional object specifying tests to include by test index. The
  627. object may contain the following fields. Can also be an optional
  628. string specifying a file with the command line syntax for
  629. :option:`--tests-information <ctest --tests-information>`.
  630. If specified as a string, this field supports macro expansion.
  631. ``start``
  632. An optional integer specifying a test index to start testing at.
  633. ``end``
  634. An optional integer specifying a test index to stop testing at.
  635. ``stride``
  636. An optional integer specifying the increment.
  637. ``specificTests``
  638. An optional array of integers specifying specific test indices to
  639. run.
  640. ``exclude``
  641. An optional object specifying which tests to exclude. The object may
  642. contain the following fields.
  643. ``name``
  644. An optional string specifying a regex for test names. Equivalent to
  645. passing :option:`--exclude-regex <ctest --exclude-regex>` on the
  646. command line. This field supports macro expansion.
  647. ``label``
  648. An optional string specifying a regex for test labels. Equivalent to
  649. passing :option:`--label-exclude <ctest --label-exclude>` on the
  650. command line. This field supports macro expansion.
  651. ``fixtures``
  652. An optional object specifying which fixtures to exclude from adding
  653. tests. The object may contain the following fields.
  654. ``any``
  655. An optional string specifying a regex for text fixtures to exclude
  656. from adding any tests. Equivalent to
  657. :option:`--fixture-exclude-any <ctest --fixture-exclude-any>` on
  658. the command line. This field supports macro expansion.
  659. ``setup``
  660. An optional string specifying a regex for text fixtures to exclude
  661. from adding setup tests. Equivalent to
  662. :option:`--fixture-exclude-setup <ctest --fixture-exclude-setup>`
  663. on the command line. This field supports macro expansion.
  664. ``cleanup``
  665. An optional string specifying a regex for text fixtures to exclude
  666. from adding cleanup tests. Equivalent to
  667. :option:`--fixture-exclude-cleanup <ctest --fixture-exclude-cleanup>`
  668. on the command line. This field supports macro expansion.
  669. ``execution``
  670. An optional object specifying options for test execution. The object may
  671. contain the following fields.
  672. ``stopOnFailure``
  673. An optional bool. If true, equivalent to passing
  674. :option:`--stop-on-failure <ctest --stop-on-failure>` on the command
  675. line.
  676. ``enableFailover``
  677. An optional bool. If true, equivalent to passing :option:`-F <ctest -F>`
  678. on the command line.
  679. ``jobs``
  680. An optional integer. Equivalent to passing
  681. :option:`--parallel <ctest --parallel>` on the command line.
  682. ``resourceSpecFile``
  683. An optional string. Equivalent to passing
  684. :option:`--resource-spec-file <ctest --resource-spec-file>` on
  685. the command line. This field supports macro expansion.
  686. ``testLoad``
  687. An optional integer. Equivalent to passing
  688. :option:`--test-load <ctest --test-load>` on the command line.
  689. ``showOnly``
  690. An optional string. Equivalent to passing
  691. :option:`--show-only <ctest --show-only>` on the
  692. command line. The string must be one of the following values:
  693. ``human``
  694. ``json-v1``
  695. ``repeat``
  696. An optional object specifying how to repeat tests. Equivalent to
  697. passing :option:`--repeat <ctest --repeat>` on the command line.
  698. The object must have the following fields.
  699. ``mode``
  700. A required string. Must be one of the following values:
  701. ``until-fail``
  702. ``until-pass``
  703. ``after-timeout``
  704. ``count``
  705. A required integer.
  706. ``interactiveDebugging``
  707. An optional bool. If true, equivalent to passing
  708. :option:`--interactive-debug-mode 1 <ctest --interactive-debug-mode>`
  709. on the command line. If false, equivalent to passing
  710. :option:`--interactive-debug-mode 0 <ctest --interactive-debug-mode>`
  711. on the command line.
  712. ``scheduleRandom``
  713. An optional bool. If true, equivalent to passing
  714. :option:`--schedule-random <ctest --schedule-random>` on the command
  715. line.
  716. ``timeout``
  717. An optional integer. Equivalent to passing
  718. :option:`--timeout <ctest --timeout>` on the command line.
  719. ``noTestsAction``
  720. An optional string specifying the behavior if no tests are found. Must
  721. be one of the following values:
  722. ``default``
  723. Equivalent to not passing any value on the command line.
  724. ``error``
  725. Equivalent to passing :option:`--no-tests=error <ctest --no-tests>`
  726. on the command line.
  727. ``ignore``
  728. Equivalent to passing :option:`--no-tests=ignore <ctest --no-tests>`
  729. on the command line.
  730. Package Preset
  731. ^^^^^^^^^^^^^^
  732. Package presets may be used in schema version ``6`` or above. Each entry of
  733. the ``packagePresets`` array is a JSON object that may contain the following
  734. fields:
  735. ``name``
  736. A required string representing the machine-friendly name of the preset.
  737. This identifier is used in the :option:`cpack --preset` option.
  738. There must not be two package presets in the union of ``CMakePresets.json``
  739. and ``CMakeUserPresets.json`` in the same directory with the same name.
  740. However, a package preset may have the same name as a configure, build,
  741. test, or workflow preset.
  742. ``hidden``
  743. An optional boolean specifying whether or not a preset should be hidden.
  744. If a preset is hidden, it cannot be used in the
  745. :option:`--preset <cpack --preset>` argument
  746. and does not have to have a valid ``configurePreset``, even from
  747. inheritance. ``hidden`` presets are intended to be used as a base for
  748. other presets to inherit via the ``inherits`` field.
  749. ``inherits``
  750. An optional array of strings representing the names of presets to inherit
  751. from. This field can also be a string, which is equivalent to an array
  752. containing one string.
  753. The preset will inherit all of the fields from the
  754. ``inherits`` presets by default (except ``name``, ``hidden``,
  755. ``inherits``, ``description``, and ``displayName``), but can override
  756. them as desired. If multiple ``inherits`` presets provide conflicting
  757. values for the same field, the earlier preset in the ``inherits`` array
  758. will be preferred.
  759. A preset can only inherit from another preset that is defined in the
  760. same file or in one of the files it includes (directly or indirectly).
  761. Presets in ``CMakePresets.json`` may not inherit from presets in
  762. ``CMakeUserPresets.json``.
  763. ``condition``
  764. An optional `Condition`_ object.
  765. ``vendor``
  766. An optional map containing vendor-specific information. CMake does not
  767. interpret the contents of this field except to verify that it is a map
  768. if it does exist. However, it should follow the same conventions as the
  769. root-level ``vendor`` field. If vendors use their own per-preset
  770. ``vendor`` field, they should implement inheritance in a sensible manner
  771. when appropriate.
  772. ``displayName``
  773. An optional string with a human-friendly name of the preset.
  774. ``description``
  775. An optional string with a human-friendly description of the preset.
  776. ``environment``
  777. An optional map of environment variables. The key is the variable name
  778. (which may not be an empty string), and the value is either ``null`` or
  779. a string representing the value of the variable. Each variable is set
  780. regardless of whether or not a value was given to it by the process's
  781. environment. This field supports macro expansion, and environment
  782. variables in this map may reference each other, and may be listed in any
  783. order, as long as such references do not cause a cycle (for example, if
  784. ``ENV_1`` is ``$env{ENV_2}``, ``ENV_2`` may not be ``$env{ENV_1}``.)
  785. Environment variables are inherited through the ``inherits`` field, and
  786. the preset's environment will be the union of its own ``environment``
  787. and the ``environment`` from all its parents. If multiple presets in
  788. this union define the same variable, the standard rules of ``inherits``
  789. are applied. Setting a variable to ``null`` causes it to not be set,
  790. even if a value was inherited from another preset.
  791. ``configurePreset``
  792. An optional string specifying the name of a configure preset to
  793. associate with this package preset. If ``configurePreset`` is not
  794. specified, it must be inherited from the inherits preset (unless this
  795. preset is hidden). The build directory is inferred from the configure
  796. preset, so packaging will run in the same ``binaryDir`` that the
  797. configuration did and build did.
  798. ``inheritConfigureEnvironment``
  799. An optional boolean that defaults to true. If true, the environment
  800. variables from the associated configure preset are inherited after all
  801. inherited package preset environments, but before environment variables
  802. explicitly specified in this package preset.
  803. ``generators``
  804. An optional array of strings representing generators for CPack to use.
  805. ``configurations``
  806. An optional array of strings representing build configurations for CPack to
  807. package.
  808. ``variables``
  809. An optional map of variables to pass to CPack, equivalent to
  810. :option:`-D <cpack -D>` arguments. Each key is the name of a variable, and
  811. the value is the string to assign to that variable.
  812. ``configFile``
  813. An optional string representing the config file for CPack to use.
  814. ``output``
  815. An optional object specifying output options. Valid keys are:
  816. ``debug``
  817. An optional boolean specifying whether or not to print debug information.
  818. A value of ``true`` is equivalent to passing
  819. :option:`--debug <cpack --debug>` on the command line.
  820. ``verbose``
  821. An optional boolean specifying whether or not to print verbosely. A value
  822. of ``true`` is equivalent to passing :option:`--verbose <cpack --verbose>`
  823. on the command line.
  824. ``packageName``
  825. An optional string representing the package name.
  826. ``packageVersion``
  827. An optional string representing the package version.
  828. ``packageDirectory``
  829. An optional string representing the directory in which to place the package.
  830. ``vendorName``
  831. An optional string representing the vendor name.
  832. .. _`Workflow Preset`:
  833. Workflow Preset
  834. ^^^^^^^^^^^^^^^
  835. Workflow presets may be used in schema version ``6`` or above. Each entry of
  836. the ``workflowPresets`` array is a JSON object that may contain the following
  837. fields:
  838. ``name``
  839. A required string representing the machine-friendly name of the preset.
  840. This identifier is used in the
  841. :ref:`cmake --workflow --preset <Workflow Mode>` option. There must not be
  842. two workflow presets in the union of ``CMakePresets.json`` and
  843. ``CMakeUserPresets.json`` in the same directory with the same name. However,
  844. a workflow preset may have the same name as a configure, build, test, or
  845. package preset.
  846. ``vendor``
  847. An optional map containing vendor-specific information. CMake does not
  848. interpret the contents of this field except to verify that it is a map
  849. if it does exist. However, it should follow the same conventions as the
  850. root-level ``vendor`` field.
  851. ``displayName``
  852. An optional string with a human-friendly name of the preset.
  853. ``description``
  854. An optional string with a human-friendly description of the preset.
  855. ``steps``
  856. A required array of objects describing the steps of the workflow. The first
  857. step must be a configure preset, and all subsequent steps must be non-
  858. configure presets whose ``configurePreset`` field matches the starting
  859. configure preset. Each object may contain the following fields:
  860. ``type``
  861. A required string. The first step must be ``configure``. Subsequent steps
  862. must be either ``build``, ``test``, or ``package``.
  863. ``name``
  864. A required string representing the name of the configure, build, test, or
  865. package preset to run as this workflow step.
  866. Condition
  867. ^^^^^^^^^
  868. The ``condition`` field of a preset, allowed in preset files specifying version
  869. ``3`` or above, is used to determine whether or not the preset is enabled. For
  870. example, this can be used to disable a preset on platforms other than Windows.
  871. ``condition`` may be either a boolean, ``null``, or an object. If it is a
  872. boolean, the boolean indicates whether the preset is enabled or disabled. If it
  873. is ``null``, the preset is enabled, but the ``null`` condition is not inherited
  874. by any presets that may inherit from the preset. Sub-conditions (for example in
  875. a ``not``, ``anyOf``, or ``allOf`` condition) may not be ``null``. If it is an
  876. object, it has the following fields:
  877. ``type``
  878. A required string with one of the following values:
  879. ``"const"``
  880. Indicates that the condition is constant. This is equivalent to using a
  881. boolean in place of the object. The condition object will have the
  882. following additional fields:
  883. ``value``
  884. A required boolean which provides a constant value for the condition's
  885. evaluation.
  886. ``"equals"``
  887. ``"notEquals"``
  888. Indicates that the condition compares two strings to see if they are equal
  889. (or not equal). The condition object will have the following additional
  890. fields:
  891. ``lhs``
  892. First string to compare. This field supports macro expansion.
  893. ``rhs``
  894. Second string to compare. This field supports macro expansion.
  895. ``"inList"``
  896. ``"notInList"``
  897. Indicates that the condition searches for a string in a list of strings.
  898. The condition object will have the following additional fields:
  899. ``string``
  900. A required string to search for. This field supports macro expansion.
  901. ``list``
  902. A required array of strings to search. This field supports macro
  903. expansion, and uses short-circuit evaluation.
  904. ``"matches"``
  905. ``"notMatches"``
  906. Indicates that the condition searches for a regular expression in a string.
  907. The condition object will have the following additional fields:
  908. ``string``
  909. A required string to search. This field supports macro expansion.
  910. ``regex``
  911. A required regular expression to search for. This field supports macro
  912. expansion.
  913. ``"anyOf"``
  914. ``"allOf"``
  915. Indicates that the condition is an aggregation of zero or more nested
  916. conditions. The condition object will have the following additional fields:
  917. ``conditions``
  918. A required array of condition objects. These conditions use short-circuit
  919. evaluation.
  920. ``"not"``
  921. Indicates that the condition is an inversion of another condition. The
  922. condition object will have the following additional fields:
  923. ``condition``
  924. A required condition object.
  925. Macro Expansion
  926. ^^^^^^^^^^^^^^^
  927. As mentioned above, some fields support macro expansion. Macros are
  928. recognized in the form ``$<macro-namespace>{<macro-name>}``. All macros are
  929. evaluated in the context of the preset being used, even if the macro is in a
  930. field that was inherited from another preset. For example, if the ``Base``
  931. preset sets variable ``PRESET_NAME`` to ``${presetName}``, and the
  932. ``Derived`` preset inherits from ``Base``, ``PRESET_NAME`` will be set to
  933. ``Derived``.
  934. It is an error to not put a closing brace at the end of a macro name. For
  935. example, ``${sourceDir`` is invalid. A dollar sign (``$``) followed by
  936. anything other than a left curly brace (``{``) with a possible namespace is
  937. interpreted as a literal dollar sign.
  938. Recognized macros include:
  939. ``${sourceDir}``
  940. Path to the project source directory (i.e. the same as
  941. :variable:`CMAKE_SOURCE_DIR`).
  942. ``${sourceParentDir}``
  943. Path to the project source directory's parent directory.
  944. ``${sourceDirName}``
  945. The last filename component of ``${sourceDir}``. For example, if
  946. ``${sourceDir}`` is ``/path/to/source``, this would be ``source``.
  947. ``${presetName}``
  948. Name specified in the preset's ``name`` field.
  949. ``${generator}``
  950. Generator specified in the preset's ``generator`` field. For build and
  951. test presets, this will evaluate to the generator specified by
  952. ``configurePreset``.
  953. ``${hostSystemName}``
  954. The name of the host operating system. Contains the same value as
  955. :variable:`CMAKE_HOST_SYSTEM_NAME`. This is allowed in preset files
  956. specifying version ``3`` or above.
  957. ``${fileDir}``
  958. Path to the directory containing the preset file which contains the macro.
  959. This is allowed in preset files specifying version ``4`` or above.
  960. ``${dollar}``
  961. A literal dollar sign (``$``).
  962. ``${pathListSep}``
  963. Native character for separating lists of paths, such as ``:`` or ``;``.
  964. For example, by setting ``PATH`` to
  965. ``/path/to/ninja/bin${pathListSep}$env{PATH}``, ``${pathListSep}`` will
  966. expand to the underlying operating system's character used for
  967. concatenation in ``PATH``.
  968. This is allowed in preset files specifying version ``5`` or above.
  969. ``$env{<variable-name>}``
  970. Environment variable with name ``<variable-name>``. The variable name may
  971. not be an empty string. If the variable is defined in the ``environment``
  972. field, that value is used instead of the value from the parent environment.
  973. If the environment variable is not defined, this evaluates as an empty
  974. string.
  975. Note that while Windows environment variable names are case-insensitive,
  976. variable names within a preset are still case-sensitive. This may lead to
  977. unexpected results when using inconsistent casing. For best results, keep
  978. the casing of environment variable names consistent.
  979. ``$penv{<variable-name>}``
  980. Similar to ``$env{<variable-name>}``, except that the value only comes from
  981. the parent environment, and never from the ``environment`` field. This
  982. allows you to prepend or append values to existing environment variables.
  983. For example, setting ``PATH`` to ``/path/to/ninja/bin:$penv{PATH}`` will
  984. prepend ``/path/to/ninja/bin`` to the ``PATH`` environment variable. This
  985. is needed because ``$env{<variable-name>}`` does not allow circular
  986. references.
  987. ``$vendor{<macro-name>}``
  988. An extension point for vendors to insert their own macros. CMake will not
  989. be able to use presets which have a ``$vendor{<macro-name>}`` macro, and
  990. effectively ignores such presets. However, it will still be able to use
  991. other presets from the same file.
  992. CMake does not make any attempt to interpret ``$vendor{<macro-name>}``
  993. macros. However, to avoid name collisions, IDE vendors should prefix
  994. ``<macro-name>`` with a very short (preferably <= 4 characters) vendor
  995. identifier prefix, followed by a ``.``, followed by the macro name. For
  996. example, the Example IDE could have ``$vendor{xide.ideInstallDir}``.
  997. Schema
  998. ======
  999. :download:`This file </manual/presets/schema.json>` provides a machine-readable
  1000. JSON schema for the ``CMakePresets.json`` format.