1CMAKE-PRESETS(7)                     CMake                    CMAKE-PRESETS(7)
2
3
4

NAME

6       cmake-presets - CMakePresets.json
7

INTRODUCTION

9       One  problem that CMake users often face is sharing settings with other
10       people for common ways to configure a project. This may be done to sup‐
11       port  CI  builds, or for users who frequently use the same build. CMake
12       supports two files, CMakePresets.json and  CMakeUserPresets.json,  that
13       allow  users  to  specify  common configure options and share them with
14       others.
15
16       CMakePresets.json and CMakeUserPresets.json live in the project's  root
17       directory.  They  both  have  exactly the same format, and both are op‐
18       tional (though at least one must be present if --preset is  specified.)
19       CMakePresets.json   is   meant   to  save  project-wide  builds,  while
20       CMakeUserPresets.json is meant for developers to save their  own  local
21       builds. CMakePresets.json may be checked into a version control system,
22       and CMakeUserPresets.json should NOT be checked in. For example,  if  a
23       project is using Git, CMakePresets.json may be tracked, and CMakeUserP‐
24       resets.json should be added to the .gitignore.
25

FORMAT

27       The files are a JSON document with an object as the root:
28
29          {
30            "version": 2,
31            "cmakeMinimumRequired": {
32              "major": 3,
33              "minor": 20,
34              "patch": 0
35            },
36            "configurePresets": [
37              {
38                "name": "default",
39                "displayName": "Default Config",
40                "description": "Default build using Ninja generator",
41                "generator": "Ninja",
42                "binaryDir": "${sourceDir}/build/default",
43                "cacheVariables": {
44                  "FIRST_CACHE_VARIABLE": {
45                    "type": "BOOL",
46                    "value": "OFF"
47                  },
48                  "SECOND_CACHE_VARIABLE": "ON"
49                },
50                "environment": {
51                  "MY_ENVIRONMENT_VARIABLE": "Test",
52                  "PATH": "$env{HOME}/ninja/bin:$penv{PATH}"
53                },
54                "vendor": {
55                  "example.com/ExampleIDE/1.0": {
56                    "autoFormat": true
57                  }
58                }
59              },
60              {
61                "name": "ninja-multi",
62                "inherits": "default",
63                "displayName": "Ninja Multi-Config",
64                "description": "Default build using Ninja Multi-Config generator",
65                "generator": "Ninja Multi-Config"
66              }
67            ],
68            "buildPresets": [
69              {
70                "name": "default",
71                "configurePreset": "default"
72              }
73            ],
74            "testPresets": [
75              {
76                "name": "default",
77                "configurePreset": "default",
78                "output": {"outputOnFailure": true},
79                "execution": {"noTestsAction": "error", "stopOnFailure": true}
80              }
81            ],
82            "vendor": {
83              "example.com/ExampleIDE/1.0": {
84                "autoFormat": false
85              }
86            }
87          }
88
89
90       The root object recognizes the following fields:
91
92       version
93          A required integer representing the version of the JSON schema.  The
94          supported versions are 1 and 2.
95
96       cmakeMinimumRequired
97          An  optional object representing the minimum version of CMake needed
98          to build this project. This object consists of the following fields:
99
100          major
101              An optional integer representing the major version.
102
103          minor
104              An optional integer representing the minor version.
105
106          patch
107              An optional integer representing the patch version.
108
109       vendor
110          An optional map containing vendor-specific information.  CMake  does
111          not interpret the contents of this field except to verify that it is
112          a map if it does exist. However, the keys should  be  a  vendor-spe‐
113          cific  domain  name followed by a /-separated path. For example, the
114          Example IDE 1.0 could use example.com/ExampleIDE/1.0. The  value  of
115          each  field can be anything desired by the vendor, though will typi‐
116          cally be a map.
117
118       configurePresets
119          An optional array of Configure Preset objects.  This is  allowed  in
120          preset files specifying version 1 or above.
121
122       buildPresets
123          An  optional array of Build Preset objects.  This is allowed in pre‐
124          set files specifying version 2 or above.
125
126       testPresets
127          An optional array of Test Preset objects.  This is allowed in preset
128          files specifying version 2 or above.
129
130   Configure Preset
131       Each entry of the configurePresets array is a JSON object that may con‐
132       tain the following fields:
133
134       name
135          A required string representing the machine-friendly name of the pre‐
136          set.   This  identifier is used in the cmake --preset option.  There
137          must not be two configure presets in the union of  CMakePresets.json
138          and  CMakeUserPresets.json in the same directory with the same name.
139          However, a configure preset may have the same name  as  a  build  or
140          test preset.
141
142       hidden
143          An  optional  boolean  specifying  whether or not a preset should be
144          hidden.  If a preset is hidden, it cannot be used in  the  --preset=
145          argument,  will  not  show up in the CMake GUI, and does not have to
146          have a valid generator or binaryDir, even from  inheritance.  hidden
147          presets  are  intended to be used as a base for other presets to in‐
148          herit via the inherits field.
149
150       inherits
151          An optional array of strings representing the names  of  presets  to
152          inherit from. The preset will inherit all of the fields from the in‐
153          herits presets by default (except name, hidden,  inherits,  descrip‐
154          tion,  and displayName), but can override them as desired. If multi‐
155          ple inherits presets provide conflicting values for the same  field,
156          the  earlier  preset in the inherits list will be preferred. Presets
157          in CMakePresets.json may not inherit from presets  in  CMakeUserPre‐
158          sets.json.
159
160          This  field  can  also  be a string, which is equivalent to an array
161          containing one string.
162
163       vendor
164          An optional map containing vendor-specific information.  CMake  does
165          not interpret the contents of this field except to verify that it is
166          a map if it does exist. However, it should follow the  same  conven‐
167          tions  as  the  root-level  vendor  field.  If vendors use their own
168          per-preset vendor field, they should implement inheritance in a sen‐
169          sible manner when appropriate.
170
171       displayName
172          An optional string with a human-friendly name of the preset.
173
174       description
175          An optional string with a human-friendly description of the preset.
176
177       generator
178          An optional string representing the generator to use for the preset.
179          If generator is not specified, it must be inherited from the  inher‐
180          its preset (unless this preset is hidden).
181
182          Note  that  for Visual Studio generators, unlike in the command line
183          -G argument, you cannot include the platform name in  the  generator
184          name. Use the architecture field instead.
185
186       architecture, toolset
187          Optional fields representing the platform and toolset, respectively,
188          for generators that support them. Each may be either a string or  an
189          object with the following fields:
190
191          value
192              An optional string representing the value.
193
194          strategy
195              An  optional string telling CMake how to handle the architecture
196              or toolset field. Valid values are:
197
198              "set"
199                 Set the respective value. This will result in  an  error  for
200                 generators that do not support the respective field.
201
202              "external"
203                 Do not set the value, even if the generator supports it. This
204                 is useful if, for example, a preset uses the Ninja generator,
205                 and  an  IDE  knows  how to set up the Visual C++ environment
206                 from the architecture and toolset fields. In that case, CMake
207                 will ignore the field, but the IDE can use them to set up the
208                 environment before invoking CMake.
209
210       binaryDir
211          An optional string representing the path to the output binary direc‐
212          tory.   This  field  supports macro expansion. If a relative path is
213          specified, it is calculated relative to the source directory. If bi‐
214          naryDir  is  not  specified,  it must be inherited from the inherits
215          preset (unless this preset is hidden).
216
217       cmakeExecutable
218          An optional string representing the path to the CMake executable  to
219          use  for  this  preset. This is reserved for use by IDEs, and is not
220          used by CMake itself. IDEs that use this  field  should  expand  any
221          macros in it.
222
223       cacheVariables
224          An  optional  map  of  cache variables. The key is the variable name
225          (which may not be an empty string), and the value is either null,  a
226          boolean  (which  is equivalent to a value of "TRUE" or "FALSE" and a
227          type of BOOL), a string  representing  the  value  of  the  variable
228          (which  supports  macro  expansion), or an object with the following
229          fields:
230
231          type
232              An optional string representing the type of the variable.
233
234          value
235              A required string or boolean representing the value of the vari‐
236              able.   A boolean is equivalent to "TRUE" or "FALSE". This field
237              supports macro expansion.
238
239          Cache variables are inherited through the inherits  field,  and  the
240          preset's  variables  will be the union of its own cacheVariables and
241          the cacheVariables from all its parents. If multiple presets in this
242          union  define  the same variable, the standard rules of inherits are
243          applied. Setting a variable to null causes it to not be set, even if
244          a value was inherited from another preset.
245
246       environment
247          An  optional  map  of environment variables. The key is the variable
248          name (which may not be an empty string), and  the  value  is  either
249          null  or a string representing the value of the variable. Each vari‐
250          able is set regardless of whether or not a value was given to it  by
251          the  process's environment. This field supports macro expansion, and
252          environment variables in this map may reference each other, and  may
253          be  listed  in  any order, as long as such references do not cause a
254          cycle (for example, if  ENV_1  is  $env{ENV_2},  ENV_2  may  not  be
255          $env{ENV_1}.)
256
257          Environment  variables are inherited through the inherits field, and
258          the preset's environment will be the union of  its  own  environment
259          and  the  environment  from  all its parents. If multiple presets in
260          this union define the same variable, the standard rules of  inherits
261          are  applied.  Setting  a  variable to null causes it to not be set,
262          even if a value was inherited from another preset.
263
264       warnings
265          An optional object specifying the warnings to enable. The object may
266          contain the following fields:
267
268          dev
269              An  optional boolean. Equivalent to passing -Wdev or -Wno-dev on
270              the command line. This may not be set to false if errors.dev  is
271              set to true.
272
273          deprecated
274              An  optional  boolean.  Equivalent  to  passing  -Wdeprecated or
275              -Wno-deprecated on the command line. This  may  not  be  set  to
276              false if errors.deprecated is set to true.
277
278          uninitialized
279              An optional boolean. Setting this to true is equivalent to pass‐
280              ing --warn-uninitialized on the command line.
281
282          unusedCli
283              An optional boolean. Setting this  to  false  is  equivalent  to
284              passing --no-warn-unused-cli on the command line.
285
286          systemVars
287              An optional boolean. Setting this to true is equivalent to pass‐
288              ing --check-system-vars on the command line.
289
290       errors
291          An optional object specifying the errors to enable. The  object  may
292          contain the following fields:
293
294          dev
295              An  optional  boolean.  Equivalent  to  passing  -Werror=dev  or
296              -Wno-error=dev on the command line. This may not be set to  true
297              if warnings.dev is set to false.
298
299          deprecated
300              An optional boolean. Equivalent to passing -Werror=deprecated or
301              -Wno-error=deprecated on the command line. This may not  be  set
302              to true if warnings.deprecated is set to false.
303
304       debug
305          An  optional object specifying debug options. The object may contain
306          the following fields:
307
308          output
309              An optional boolean. Setting this to true is equivalent to pass‐
310              ing --debug-output on the command line.
311
312          tryCompile
313              An optional boolean. Setting this to true is equivalent to pass‐
314              ing --debug-trycompile on the command line.
315
316          find
317              An optional boolean. Setting this to true is equivalent to pass‐
318              ing --debug-find on the command line.
319
320   Build Preset
321       Each  entry of the buildPresets array is a JSON object that may contain
322       the following fields:
323
324       name
325          A required string representing the machine-friendly name of the pre‐
326          set.   This identifier is used in the cmake --build --preset option.
327          There must not be two  build  presets  in  the  union  of  CMakePre‐
328          sets.json  and  CMakeUserPresets.json in the same directory with the
329          same name.  However, a build preset may have the same name as a con‐
330          figure or test preset.
331
332       hidden
333          An  optional  boolean  specifying  whether or not a preset should be
334          hidden.  If a preset is hidden, it cannot be used  in  the  --preset
335          argument  and  does  not  have to have a valid configurePreset, even
336          from inheritance. hidden presets are intended to be used as  a  base
337          for other presets to inherit via the inherits field.
338
339       inherits
340          An  optional  array  of strings representing the names of presets to
341          inherit from. The preset will inherit all of the fields from the in‐
342          herits  presets  by default (except name, hidden, inherits, descrip‐
343          tion, and displayName), but can override them as desired. If  multi‐
344          ple  inherits presets provide conflicting values for the same field,
345          the earlier preset in the inherits list will be  preferred.  Presets
346          in  CMakePresets.json  may not inherit from presets in CMakeUserPre‐
347          sets.json.
348
349          This field can also be a string, which is  equivalent  to  an  array
350          containing one string.
351
352       vendor
353          An  optional  map containing vendor-specific information. CMake does
354          not interpret the contents of this field except to verify that it is
355          a  map  if it does exist. However, it should follow the same conven‐
356          tions as the root-level vendor  field.  If  vendors  use  their  own
357          per-preset vendor field, they should implement inheritance in a sen‐
358          sible manner when appropriate.
359
360       displayName
361          An optional string with a human-friendly name of the preset.
362
363       description
364          An optional string with a human-friendly description of the preset.
365
366       environment
367          An optional map of environment variables. The key  is  the  variable
368          name  (which  may  not  be an empty string), and the value is either
369          null or a string representing the value of the variable. Each  vari‐
370          able  is set regardless of whether or not a value was given to it by
371          the process's environment. This field supports macro expansion,  and
372          environment  variables in this map may reference each other, and may
373          be listed in any order, as long as such references do  not  cause  a
374          cycle  (for  example,  if  ENV_1  is  $env{ENV_2},  ENV_2 may not be
375          $env{ENV_1}.)
376
377          Environment variables are inherited through the inherits field,  and
378          the  preset's  environment  will be the union of its own environment
379          and the environment from all its parents.  If  multiple  presets  in
380          this  union define the same variable, the standard rules of inherits
381          are applied. Setting a variable to null causes it  to  not  be  set,
382          even if a value was inherited from another preset.
383
384       configurePreset
385          An  optional string specifying the name of a configure preset to as‐
386          sociate with this build preset. If configurePreset is not specified,
387          it must be inherited from the inherits preset (unless this preset is
388          hidden). The build directory is inferred from the configure  preset,
389          so the build will take place in the same binaryDir that the configu‐
390          ration did.
391
392       inheritConfigureEnvironment
393          An optional boolean that defaults to true. If true, the  environment
394          variables  from  the associated configure preset are inherited after
395          all inherited build  preset  environments,  but  before  environment
396          variables explicitly specified in this build preset.
397
398       jobs
399          An  optional  integer. Equivalent to passing --parallel or -j on the
400          command line.
401
402       targets
403          An optional string or array of strings. Equivalent to passing --tar‐
404          get  or -t on the command line. Vendors may ignore the targets prop‐
405          erty or hide build presets that explicitly  specify  targets.   This
406          field supports macro expansion.
407
408       configuration
409          An  optional  string.  Equivalent to passing --config on the command
410          line.
411
412       cleanFirst
413          An optional bool. If true, equivalent to  passing  --clean-first  on
414          the command line.
415
416       verbose
417          An  optional  bool.  If true, equivalent to passing --verbose on the
418          command line.
419
420       nativeToolOptions
421          An optional array of strings. Equivalent to passing options after --
422          on the command line. The array values support macro expansion.
423
424   Test Preset
425       Each  entry  of the testPresets array is a JSON object that may contain
426       the following fields:
427
428       name
429          A required string representing the machine-friendly name of the pre‐
430          set.   This  identifier is used in the ctest --preset option.  There
431          must not be two test presets in the union of  CMakePresets.json  and
432          CMakeUserPresets.json  in  the  same  directory  with the same name.
433          However, a test preset may have the same  name  as  a  configure  or
434          build preset.
435
436       hidden
437          An  optional  boolean  specifying  whether or not a preset should be
438          hidden.  If a preset is hidden, it cannot be used  in  the  --preset
439          argument  and  does  not  have to have a valid configurePreset, even
440          from inheritance. hidden presets are intended to be used as  a  base
441          for other presets to inherit via the inherits field.
442
443       inherits
444          An  optional  array  of strings representing the names of presets to
445          inherit from. The preset will inherit all of the fields from the in‐
446          herits  presets  by default (except name, hidden, inherits, descrip‐
447          tion, and displayName), but can override them as desired. If  multi‐
448          ple  inherits presets provide conflicting values for the same field,
449          the earlier preset in the inherits list will be  preferred.  Presets
450          in  CMakePresets.json  may not inherit from presets in CMakeUserPre‐
451          sets.json.
452
453          This field can also be a string, which is  equivalent  to  an  array
454          containing one string.
455
456       vendor
457          An  optional  map containing vendor-specific information. CMake does
458          not interpret the contents of this field except to verify that it is
459          a  map  if it does exist. However, it should follow the same conven‐
460          tions as the root-level vendor  field.  If  vendors  use  their  own
461          per-preset vendor field, they should implement inheritance in a sen‐
462          sible manner when appropriate.
463
464       displayName
465          An optional string with a human-friendly name of the preset.
466
467       description
468          An optional string with a human-friendly description of the preset.
469
470       environment
471          An optional map of environment variables. The key  is  the  variable
472          name  (which  may  not  be an empty string), and the value is either
473          null or a string representing the value of the variable. Each  vari‐
474          able  is set regardless of whether or not a value was given to it by
475          the process's environment. This field supports macro expansion,  and
476          environment  variables in this map may reference each other, and may
477          be listed in any order, as long as such references do  not  cause  a
478          cycle  (for  example,  if  ENV_1  is  $env{ENV_2},  ENV_2 may not be
479          $env{ENV_1}.)
480
481          Environment variables are inherited through the inherits field,  and
482          the  preset's  environment  will be the union of its own environment
483          and the environment from all its parents.  If  multiple  presets  in
484          this  union define the same variable, the standard rules of inherits
485          are applied. Setting a variable to null causes it  to  not  be  set,
486          even if a value was inherited from another preset.
487
488       configurePreset
489          An  optional string specifying the name of a configure preset to as‐
490          sociate with this test preset. If configurePreset is not  specified,
491          it must be inherited from the inherits preset (unless this preset is
492          hidden). The build directory is inferred from the configure  preset,
493          so  tests  will run in the same binaryDir that the configuration did
494          and build did.
495
496       inheritConfigureEnvironment
497          An optional boolean that defaults to true. If true, the  environment
498          variables  from  the associated configure preset are inherited after
499          all inherited test preset environments, but before environment vari‐
500          ables explicitly specified in this test preset.
501
502       configuration
503          An optional string. Equivalent to passing --build-config on the com‐
504          mand line.
505
506       overwriteConfigurationFile
507          An optional array of  configuration  options  to  overwrite  options
508          specified  in  the  CTest  configuration file. Equivalent to passing
509          --overwrite for each value in the array. The  array  values  support
510          macro expansion.
511
512       output
513          An optional object specifying output options. The object may contain
514          the following fields.
515
516          shortProgress
517              An optional bool. If true, equivalent to passing  --progress  on
518              the command line.
519
520          verbosity
521              An  optional  string  specifying verbosity level. Must be one of
522              the following:
523
524              default
525                 Equivalent to passing no verbosity flags on the command line.
526
527              verbose
528                 Equivalent to passing --verbose on the command line.
529
530              extra
531                 Equivalent to passing --extra-verbose on the command line.
532
533          debug
534              An optional bool. If true, equivalent to passing --debug on  the
535              command line.
536
537          outputOnFailure
538              An   optional  bool.  If  true,  equivalent  to  passing  --out‐
539              put-on-failure on the command line.
540
541          quiet
542              An optional bool. If true, equivalent to passing --quiet on  the
543              command line.
544
545          outputLogFile
546              An  optional  string specifying a path to a log file. Equivalent
547              to passing --output-log on the command line. This field supports
548              macro expansion.
549
550          labelSummary
551              An  optional  bool.  If  false,  equivalent  to passing --no-la‐
552              bel-summary on the command line.
553
554          subprojectSummary
555              An optional bool. If false, equivalent to  passing  --no-subpro‐
556              ject-summary on the command line.
557
558          maxPassedTestOutputSize
559              An  optional  integer  specifying  the maximum output for passed
560              tests in bytes. Equivalent to passing  --test-output-size-passed
561              on the command line.
562
563          maxFailedTestOutputSize
564              An  optional  integer  specifying  the maximum output for failed
565              tests in bytes. Equivalent to passing  --test-output-size-failed
566              on the command line.
567
568          maxTestNameWidth
569              An  optional integer specifying the maximum width of a test name
570              to output. Equivalent to  passing  --max-width  on  the  command
571              line.
572
573       filter
574          An  optional  object  specifying how to filter the tests to run. The
575          object may contain the following fields.
576
577          include
578              An optional object specifying which tests to include. The object
579              may contain the following fields.
580
581              name
582                 An optional string specifying a regex for test names. Equiva‐
583                 lent to passing --tests-regex on the command line. This field
584                 supports macro expansion.
585
586              label
587                 An optional string specifying a regex for test labels. Equiv‐
588                 alent to passing --label-regex  on  the  command  line.  This
589                 field supports macro expansion.
590
591              useUnion
592                 An  optional  bool. Equivalent to passing --union on the com‐
593                 mand line.
594
595              index
596                 An optional object specifying tests to include by test index.
597                 The  object  may contain the following fields. Can also be an
598                 optional string specifying a file with the command line  syn‐
599                 tax  for  --tests-information. If specified as a string, this
600                 field supports macro expansion.
601
602                 start
603                     An optional integer specifying  a  test  index  to  start
604                     testing at.
605
606                 end
607                     An optional integer specifying a test index to stop test‐
608                     ing at.
609
610                 stride
611                     An optional integer specifying the increment.
612
613                 specificTests
614                     An optional array of integers  specifying  specific  test
615                     indices to run.
616
617          exclude
618              An optional object specifying which tests to exclude. The object
619              may contain the following fields.
620
621              name
622                 An optional string specifying a regex for test names. Equiva‐
623                 lent  to  passing  --exclude-regex  on the command line. This
624                 field supports macro expansion.
625
626              label
627                 An optional string specifying a regex for test labels. Equiv‐
628                 alent  to  passing  --label-exclude on the command line. This
629                 field supports macro expansion.
630
631              fixtures
632                 An optional object specifying which fixtures to exclude  from
633                 adding tests. The object may contain the following fields.
634
635                 any
636                     An  optional  string specifying a regex for text fixtures
637                     to exclude from adding any tests.  Equivalent  to  --fix‐
638                     ture-exclude-any on the command line. This field supports
639                     macro expansion.
640
641                 setup
642                     An optional string specifying a regex for  text  fixtures
643                     to  exclude from adding setup tests. Equivalent to --fix‐
644                     ture-exclude-setup on the command line. This  field  sup‐
645                     ports macro expansion.
646
647                 cleanup
648                     An  optional  string specifying a regex for text fixtures
649                     to exclude  from  adding  cleanup  tests.  Equivalent  to
650                     --fixture-exclude-cleanup on the command line. This field
651                     supports macro expansion.
652
653       execution
654          An optional object specifying options for test execution. The object
655          may contain the following fields.
656
657          stopOnFailure
658              An optional bool. If true, equivalent to passing --stop-on-fail‐
659              ure on the command line.
660
661          enableFailover
662              An optional bool. If true, equivalent to passing -F on the  com‐
663              mand line.
664
665          jobs
666              An  optional  integer.  Equivalent  to passing --parallel on the
667              command line.
668
669          resourceSpecFile
670              An optional string. Equivalent to  passing  --resource-spec-file
671              on the command line. This field supports macro expansion.
672
673          testLoad
674              An  optional  integer.  Equivalent to passing --test-load on the
675              command line.
676
677          showOnly
678              An optional string. Equivalent to  passing  --show-only  on  the
679              command line. The string must be one of the following values:
680
681              human
682
683              json-v1
684
685          repeat
686              An optional object specifying how to repeat tests. Equivalent to
687              passing --repeat on the command line. The object must  have  the
688              following fields.
689
690              mode
691                 A required string. Must be one of the following values:
692
693                 until-fail
694
695                 until-pass
696
697                 after-timeout
698
699              count
700                 A required integer.
701
702          interactiveDebugging
703              An  optional  bool.  If  true,  equivalent to passing --interac‐
704              tive-debug-mode 1 on the command line. If false,  equivalent  to
705              passing --interactive-debug-mode 0 on the command line.
706
707          scheduleRandom
708              An optional bool. If true, equivalent to passing --schedule-ran‐
709              dom on the command line.
710
711          timeout
712              An optional integer. Equivalent to passing --timeout on the com‐
713              mand line.
714
715          noTestsAction
716              An  optional  string  specifying  the  behavior  if no tests are
717              found. Must be one of the following values:
718
719              default
720                 Equivalent to not passing any value on the command line.
721
722              error
723                 Equivalent to passing --no-tests=error on the command line.
724
725              ignore
726                 Equivalent to passing --no-tests=ignore on the command line.
727
728   Macro Expansion
729       As mentioned above, some fields support  macro  expansion.  Macros  are
730       recognized in the form $<macro-namespace>{<macro-name>}. All macros are
731       evaluated in the context of the preset being used, even if the macro is
732       in  a field that was inherited from another preset. For example, if the
733       Base preset sets variable PRESET_NAME to ${presetName}, and the Derived
734       preset inherits from Base, PRESET_NAME will be set to Derived.
735
736       It  is  an error to not put a closing brace at the end of a macro name.
737       For example, ${sourceDir is invalid. A dollar sign ($) followed by any‐
738       thing  other  than  a left curly brace ({) with a possible namespace is
739       interpreted as a literal dollar sign.
740
741       Recognized macros include:
742
743       ${sourceDir}
744          Path to the project source directory.
745
746       ${sourceParentDir}
747          Path to the project source directory's parent directory.
748
749       ${sourceDirName}
750          The  last  filename  component  of  ${sourceDir}.  For  example,  if
751          ${sourceDir} is /path/to/source, this would be source.
752
753       ${presetName}
754          Name specified in the preset's name field.
755
756       ${generator}
757          Generator  specified  in the preset's generator field. For build and
758          test presets, this will evaluate to the generator specified by  con‐
759          figurePreset.
760
761       ${dollar}
762          A literal dollar sign ($).
763
764       $env{<variable-name>}
765          Environment  variable  with  name <variable-name>. The variable name
766          may not be an empty string. If the variable is defined in the  envi‐
767          ronment field, that value is used instead of the value from the par‐
768          ent environment.  If the environment variable is not  defined,  this
769          evaluates as an empty string.
770
771          Note that while Windows environment variable names are case-insensi‐
772          tive, variable names within a preset are still case-sensitive.  This
773          may  lead  to unexpected results when using inconsistent casing. For
774          best results, keep the casing of environment variable names  consis‐
775          tent.
776
777       $penv{<variable-name>}
778          Similar  to  $env{<variable-name>}, except that the value only comes
779          from the parent environment, and never from the  environment  field.
780          This  allows you to prepend or append values to existing environment
781          variables.       For      example,       setting       PATH       to
782          /path/to/ninja/bin:$penv{PATH}  will  prepend  /path/to/ninja/bin to
783          the PATH environment variable. This is  needed  because  $env{<vari‐
784          able-name>} does not allow circular references.
785
786       $vendor{<macro-name>}
787          An  extension  point  for  vendors to insert their own macros. CMake
788          will not be able to use presets which have  a  $vendor{<macro-name>}
789          macro,  and effectively ignores such presets. However, it will still
790          be able to use other presets from the same file.
791
792          CMake does not make any attempt to  interpret  $vendor{<macro-name>}
793          macros. However, to avoid name collisions, IDE vendors should prefix
794          <macro-name> with a very short (preferably <= 4  characters)  vendor
795          identifier  prefix, followed by a ., followed by the macro name. For
796          example, the Example IDE could have $vendor{xide.ideInstallDir}.
797

SCHEMA

799       This file provides a machine-readable JSON  schema  for  the  CMakePre‐
800       sets.json format.
801
803       2000-2021 Kitware, Inc. and Contributors
804
805
806
807
8083.20.3                           May 30, 2021                 CMAKE-PRESETS(7)
Impressum