cmake-presets.7.rst 50 KB

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