cmake-presets.7.rst 50 KB

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