1.. cmake-manual-description: CMake File-Based API
2
3cmake-file-api(7)
4*****************
5
6.. only:: html
7
8   .. contents::
9
10Introduction
11============
12
13CMake provides a file-based API that clients may use to get semantic
14information about the buildsystems CMake generates.  Clients may use
15the API by writing query files to a specific location in a build tree
16to request zero or more `Object Kinds`_.  When CMake generates the
17buildsystem in that build tree it will read the query files and write
18reply files for the client to read.
19
20The file-based API uses a ``<build>/.cmake/api/`` directory at the top
21of a build tree.  The API is versioned to support changes to the layout
22of files within the API directory.  API file layout versioning is
23orthogonal to the versioning of `Object Kinds`_ used in replies.
24This version of CMake supports only one API version, `API v1`_.
25
26API v1
27======
28
29API v1 is housed in the ``<build>/.cmake/api/v1/`` directory.
30It has the following subdirectories:
31
32``query/``
33  Holds query files written by clients.
34  These may be `v1 Shared Stateless Query Files`_,
35  `v1 Client Stateless Query Files`_, or `v1 Client Stateful Query Files`_.
36
37``reply/``
38  Holds reply files written by CMake whenever it runs to generate a build
39  system.  These are indexed by a `v1 Reply Index File`_ file that may
40  reference additional `v1 Reply Files`_.  CMake owns all reply files.
41  Clients must never remove them.
42
43  Clients may look for and read a reply index file at any time.
44  Clients may optionally create the ``reply/`` directory at any time
45  and monitor it for the appearance of a new reply index file.
46
47v1 Shared Stateless Query Files
48-------------------------------
49
50Shared stateless query files allow clients to share requests for
51major versions of the `Object Kinds`_ and get all requested versions
52recognized by the CMake that runs.
53
54Clients may create shared requests by creating empty files in the
55``v1/query/`` directory.  The form is::
56
57  <build>/.cmake/api/v1/query/<kind>-v<major>
58
59where ``<kind>`` is one of the `Object Kinds`_, ``-v`` is literal,
60and ``<major>`` is the major version number.
61
62Files of this form are stateless shared queries not owned by any specific
63client.  Once created they should not be removed without external client
64coordination or human intervention.
65
66v1 Client Stateless Query Files
67-------------------------------
68
69Client stateless query files allow clients to create owned requests for
70major versions of the `Object Kinds`_ and get all requested versions
71recognized by the CMake that runs.
72
73Clients may create owned requests by creating empty files in
74client-specific query subdirectories.  The form is::
75
76  <build>/.cmake/api/v1/query/client-<client>/<kind>-v<major>
77
78where ``client-`` is literal, ``<client>`` is a string uniquely
79identifying the client, ``<kind>`` is one of the `Object Kinds`_,
80``-v`` is literal, and ``<major>`` is the major version number.
81Each client must choose a unique ``<client>`` identifier via its
82own means.
83
84Files of this form are stateless queries owned by the client ``<client>``.
85The owning client may remove them at any time.
86
87v1 Client Stateful Query Files
88------------------------------
89
90Stateful query files allow clients to request a list of versions of
91each of the `Object Kinds`_ and get only the most recent version
92recognized by the CMake that runs.
93
94Clients may create owned stateful queries by creating ``query.json``
95files in client-specific query subdirectories.  The form is::
96
97  <build>/.cmake/api/v1/query/client-<client>/query.json
98
99where ``client-`` is literal, ``<client>`` is a string uniquely
100identifying the client, and ``query.json`` is literal.  Each client
101must choose a unique ``<client>`` identifier via its own means.
102
103``query.json`` files are stateful queries owned by the client ``<client>``.
104The owning client may update or remove them at any time.  When a
105given client installation is updated it may then update the stateful
106query it writes to build trees to request newer object versions.
107This can be used to avoid asking CMake to generate multiple object
108versions unnecessarily.
109
110A ``query.json`` file must contain a JSON object:
111
112.. code-block:: json
113
114  {
115    "requests": [
116      { "kind": "<kind>" , "version": 1 },
117      { "kind": "<kind>" , "version": { "major": 1, "minor": 2 } },
118      { "kind": "<kind>" , "version": [2, 1] },
119      { "kind": "<kind>" , "version": [2, { "major": 1, "minor": 2 }] },
120      { "kind": "<kind>" , "version": 1, "client": {} },
121      { "kind": "..." }
122    ],
123    "client": {}
124  }
125
126The members are:
127
128``requests``
129  A JSON array containing zero or more requests.  Each request is
130  a JSON object with members:
131
132  ``kind``
133    Specifies one of the `Object Kinds`_ to be included in the reply.
134
135  ``version``
136    Indicates the version(s) of the object kind that the client
137    understands.  Versions have major and minor components following
138    semantic version conventions.  The value must be
139
140    * a JSON integer specifying a (non-negative) major version number, or
141    * a JSON object containing ``major`` and (optionally) ``minor``
142      members specifying non-negative integer version components, or
143    * a JSON array whose elements are each one of the above.
144
145  ``client``
146    Optional member reserved for use by the client.  This value is
147    preserved in the reply written for the client in the
148    `v1 Reply Index File`_ but is otherwise ignored.  Clients may use
149    this to pass custom information with a request through to its reply.
150
151  For each requested object kind CMake will choose the *first* version
152  that it recognizes for that kind among those listed in the request.
153  The response will use the selected *major* version with the highest
154  *minor* version known to the running CMake for that major version.
155  Therefore clients should list all supported major versions in
156  preferred order along with the minimal minor version required
157  for each major version.
158
159``client``
160  Optional member reserved for use by the client.  This value is
161  preserved in the reply written for the client in the
162  `v1 Reply Index File`_ but is otherwise ignored.  Clients may use
163  this to pass custom information with a query through to its reply.
164
165Other ``query.json`` top-level members are reserved for future use.
166If present they are ignored for forward compatibility.
167
168v1 Reply Index File
169-------------------
170
171CMake writes an ``index-*.json`` file to the ``v1/reply/`` directory
172whenever it runs to generate a build system.  Clients must read the
173reply index file first and may read other `v1 Reply Files`_ only by
174following references.  The form of the reply index file name is::
175
176  <build>/.cmake/api/v1/reply/index-<unspecified>.json
177
178where ``index-`` is literal and ``<unspecified>`` is an unspecified
179name selected by CMake.  Whenever a new index file is generated it
180is given a new name and any old one is deleted.  During the short
181time between these steps there may be multiple index files present;
182the one with the largest name in lexicographic order is the current
183index file.
184
185The reply index file contains a JSON object:
186
187.. code-block:: json
188
189  {
190    "cmake": {
191      "version": {
192        "major": 3, "minor": 14, "patch": 0, "suffix": "",
193        "string": "3.14.0", "isDirty": false
194      },
195      "paths": {
196        "cmake": "/prefix/bin/cmake",
197        "ctest": "/prefix/bin/ctest",
198        "cpack": "/prefix/bin/cpack",
199        "root": "/prefix/share/cmake-3.14"
200      },
201      "generator": {
202        "multiConfig": false,
203        "name": "Unix Makefiles"
204      }
205    },
206    "objects": [
207      { "kind": "<kind>",
208        "version": { "major": 1, "minor": 0 },
209        "jsonFile": "<file>" },
210      { "...": "..." }
211    ],
212    "reply": {
213      "<kind>-v<major>": { "kind": "<kind>",
214                           "version": { "major": 1, "minor": 0 },
215                           "jsonFile": "<file>" },
216      "<unknown>": { "error": "unknown query file" },
217      "...": {},
218      "client-<client>": {
219        "<kind>-v<major>": { "kind": "<kind>",
220                             "version": { "major": 1, "minor": 0 },
221                             "jsonFile": "<file>" },
222        "<unknown>": { "error": "unknown query file" },
223        "...": {},
224        "query.json": {
225          "requests": [ {}, {}, {} ],
226          "responses": [
227            { "kind": "<kind>",
228              "version": { "major": 1, "minor": 0 },
229              "jsonFile": "<file>" },
230            { "error": "unknown query file" },
231            { "...": {} }
232          ],
233          "client": {}
234        }
235      }
236    }
237  }
238
239The members are:
240
241``cmake``
242  A JSON object containing information about the instance of CMake that
243  generated the reply.  It contains members:
244
245  ``version``
246    A JSON object specifying the version of CMake with members:
247
248    ``major``, ``minor``, ``patch``
249      Integer values specifying the major, minor, and patch version components.
250    ``suffix``
251      A string specifying the version suffix, if any, e.g. ``g0abc3``.
252    ``string``
253      A string specifying the full version in the format
254      ``<major>.<minor>.<patch>[-<suffix>]``.
255    ``isDirty``
256      A boolean indicating whether the version was built from a version
257      controlled source tree with local modifications.
258
259  ``paths``
260    A JSON object specifying paths to things that come with CMake.
261    It has members for ``cmake``, ``ctest``, and ``cpack`` whose values
262    are JSON strings specifying the absolute path to each tool,
263    represented with forward slashes.  It also has a ``root`` member for
264    the absolute path to the directory containing CMake resources like the
265    ``Modules/`` directory (see :variable:`CMAKE_ROOT`).
266
267  ``generator``
268    A JSON object describing the CMake generator used for the build.
269    It has members:
270
271    ``multiConfig``
272      A boolean specifying whether the generator supports multiple output
273      configurations.
274    ``name``
275      A string specifying the name of the generator.
276    ``platform``
277      If the generator supports :variable:`CMAKE_GENERATOR_PLATFORM`,
278      this is a string specifying the generator platform name.
279
280``objects``
281  A JSON array listing all versions of all `Object Kinds`_ generated
282  as part of the reply.  Each array entry is a
283  `v1 Reply File Reference`_.
284
285``reply``
286  A JSON object mirroring the content of the ``query/`` directory
287  that CMake loaded to produce the reply.  The members are of the form
288
289  ``<kind>-v<major>``
290    A member of this form appears for each of the
291    `v1 Shared Stateless Query Files`_ that CMake recognized as a
292    request for object kind ``<kind>`` with major version ``<major>``.
293    The value is a `v1 Reply File Reference`_ to the corresponding
294    reply file for that object kind and version.
295
296  ``<unknown>``
297    A member of this form appears for each of the
298    `v1 Shared Stateless Query Files`_ that CMake did not recognize.
299    The value is a JSON object with a single ``error`` member
300    containing a string with an error message indicating that the
301    query file is unknown.
302
303  ``client-<client>``
304    A member of this form appears for each client-owned directory
305    holding `v1 Client Stateless Query Files`_.
306    The value is a JSON object mirroring the content of the
307    ``query/client-<client>/`` directory.  The members are of the form:
308
309    ``<kind>-v<major>``
310      A member of this form appears for each of the
311      `v1 Client Stateless Query Files`_ that CMake recognized as a
312      request for object kind ``<kind>`` with major version ``<major>``.
313      The value is a `v1 Reply File Reference`_ to the corresponding
314      reply file for that object kind and version.
315
316    ``<unknown>``
317      A member of this form appears for each of the
318      `v1 Client Stateless Query Files`_ that CMake did not recognize.
319      The value is a JSON object with a single ``error`` member
320      containing a string with an error message indicating that the
321      query file is unknown.
322
323    ``query.json``
324      This member appears for clients using
325      `v1 Client Stateful Query Files`_.
326      If the ``query.json`` file failed to read or parse as a JSON object,
327      this member is a JSON object with a single ``error`` member
328      containing a string with an error message.  Otherwise, this member
329      is a JSON object mirroring the content of the ``query.json`` file.
330      The members are:
331
332      ``client``
333        A copy of the ``query.json`` file ``client`` member, if it exists.
334
335      ``requests``
336        A copy of the ``query.json`` file ``requests`` member, if it exists.
337
338      ``responses``
339        If the ``query.json`` file ``requests`` member is missing or invalid,
340        this member is a JSON object with a single ``error`` member
341        containing a string with an error message.  Otherwise, this member
342        contains a JSON array with a response for each entry of the
343        ``requests`` array, in the same order.  Each response is
344
345        * a JSON object with a single ``error`` member containing a string
346          with an error message, or
347        * a `v1 Reply File Reference`_ to the corresponding reply file for
348          the requested object kind and selected version.
349
350After reading the reply index file, clients may read the other
351`v1 Reply Files`_ it references.
352
353v1 Reply File Reference
354^^^^^^^^^^^^^^^^^^^^^^^
355
356The reply index file represents each reference to another reply file
357using a JSON object with members:
358
359``kind``
360  A string specifying one of the `Object Kinds`_.
361``version``
362  A JSON object with members ``major`` and ``minor`` specifying
363  integer version components of the object kind.
364``jsonFile``
365  A JSON string specifying a path relative to the reply index file
366  to another JSON file containing the object.
367
368v1 Reply Files
369--------------
370
371Reply files containing specific `Object Kinds`_ are written by CMake.
372The names of these files are unspecified and must not be interpreted
373by clients.  Clients must first read the `v1 Reply Index File`_ and
374and follow references to the names of the desired response objects.
375
376Reply files (including the index file) will never be replaced by
377files of the same name but different content.  This allows a client
378to read the files concurrently with a running CMake that may generate
379a new reply.  However, after generating a new reply CMake will attempt
380to remove reply files from previous runs that it did not just write.
381If a client attempts to read a reply file referenced by the index but
382finds the file missing, that means a concurrent CMake has generated
383a new reply.  The client may simply start again by reading the new
384reply index file.
385
386.. _`file-api object kinds`:
387
388Object Kinds
389============
390
391The CMake file-based API reports semantic information about the build
392system using the following kinds of JSON objects.  Each kind of object
393is versioned independently using semantic versioning with major and
394minor components.  Every kind of object has the form:
395
396.. code-block:: json
397
398  {
399    "kind": "<kind>",
400    "version": { "major": 1, "minor": 0 },
401    "...": {}
402  }
403
404The ``kind`` member is a string specifying the object kind name.
405The ``version`` member is a JSON object with ``major`` and ``minor``
406members specifying integer components of the object kind's version.
407Additional top-level members are specific to each object kind.
408
409Object Kind "codemodel"
410-----------------------
411
412The ``codemodel`` object kind describes the build system structure as
413modeled by CMake.
414
415There is only one ``codemodel`` object major version, version 2.
416Version 1 does not exist to avoid confusion with that from
417:manual:`cmake-server(7)` mode.
418
419"codemodel" version 2
420^^^^^^^^^^^^^^^^^^^^^
421
422``codemodel`` object version 2 is a JSON object:
423
424.. code-block:: json
425
426  {
427    "kind": "codemodel",
428    "version": { "major": 2, "minor": 2 },
429    "paths": {
430      "source": "/path/to/top-level-source-dir",
431      "build": "/path/to/top-level-build-dir"
432    },
433    "configurations": [
434      {
435        "name": "Debug",
436        "directories": [
437          {
438            "source": ".",
439            "build": ".",
440            "childIndexes": [ 1 ],
441            "projectIndex": 0,
442            "targetIndexes": [ 0 ],
443            "hasInstallRule": true,
444            "minimumCMakeVersion": {
445              "string": "3.14"
446            },
447            "jsonFile": "<file>"
448          },
449          {
450            "source": "sub",
451            "build": "sub",
452            "parentIndex": 0,
453            "projectIndex": 0,
454            "targetIndexes": [ 1 ],
455            "minimumCMakeVersion": {
456              "string": "3.14"
457            },
458            "jsonFile": "<file>"
459          }
460        ],
461        "projects": [
462          {
463            "name": "MyProject",
464            "directoryIndexes": [ 0, 1 ],
465            "targetIndexes": [ 0, 1 ]
466          }
467        ],
468        "targets": [
469          {
470            "name": "MyExecutable",
471            "directoryIndex": 0,
472            "projectIndex": 0,
473            "jsonFile": "<file>"
474          },
475          {
476            "name": "MyLibrary",
477            "directoryIndex": 1,
478            "projectIndex": 0,
479            "jsonFile": "<file>"
480          }
481        ]
482      }
483    ]
484  }
485
486The members specific to ``codemodel`` objects are:
487
488``paths``
489  A JSON object containing members:
490
491  ``source``
492    A string specifying the absolute path to the top-level source directory,
493    represented with forward slashes.
494
495  ``build``
496    A string specifying the absolute path to the top-level build directory,
497    represented with forward slashes.
498
499``configurations``
500  A JSON array of entries corresponding to available build configurations.
501  On single-configuration generators there is one entry for the value
502  of the :variable:`CMAKE_BUILD_TYPE` variable.  For multi-configuration
503  generators there is an entry for each configuration listed in the
504  :variable:`CMAKE_CONFIGURATION_TYPES` variable.
505  Each entry is a JSON object containing members:
506
507  ``name``
508    A string specifying the name of the configuration, e.g. ``Debug``.
509
510  ``directories``
511    A JSON array of entries each corresponding to a build system directory
512    whose source directory contains a ``CMakeLists.txt`` file.  The first
513    entry corresponds to the top-level directory.  Each entry is a
514    JSON object containing members:
515
516    ``source``
517      A string specifying the path to the source directory, represented
518      with forward slashes.  If the directory is inside the top-level
519      source directory then the path is specified relative to that
520      directory (with ``.`` for the top-level source directory itself).
521      Otherwise the path is absolute.
522
523    ``build``
524      A string specifying the path to the build directory, represented
525      with forward slashes.  If the directory is inside the top-level
526      build directory then the path is specified relative to that
527      directory (with ``.`` for the top-level build directory itself).
528      Otherwise the path is absolute.
529
530    ``parentIndex``
531      Optional member that is present when the directory is not top-level.
532      The value is an unsigned integer 0-based index of another entry in
533      the main ``directories`` array that corresponds to the parent
534      directory that added this directory as a subdirectory.
535
536    ``childIndexes``
537      Optional member that is present when the directory has subdirectories.
538      The value is a JSON array of entries corresponding to child directories
539      created by the :command:`add_subdirectory` or :command:`subdirs`
540      command.  Each entry is an unsigned integer 0-based index of another
541      entry in the main ``directories`` array.
542
543    ``projectIndex``
544      An unsigned integer 0-based index into the main ``projects`` array
545      indicating the build system project to which the this directory belongs.
546
547    ``targetIndexes``
548      Optional member that is present when the directory itself has targets,
549      excluding those belonging to subdirectories.  The value is a JSON
550      array of entries corresponding to the targets.  Each entry is an
551      unsigned integer 0-based index into the main ``targets`` array.
552
553    ``minimumCMakeVersion``
554      Optional member present when a minimum required version of CMake is
555      known for the directory.  This is the ``<min>`` version given to the
556      most local call to the :command:`cmake_minimum_required(VERSION)`
557      command in the directory itself or one of its ancestors.
558      The value is a JSON object with one member:
559
560      ``string``
561        A string specifying the minimum required version in the format::
562
563          <major>.<minor>[.<patch>[.<tweak>]][<suffix>]
564
565        Each component is an unsigned integer and the suffix may be an
566        arbitrary string.
567
568    ``hasInstallRule``
569      Optional member that is present with boolean value ``true`` when
570      the directory or one of its subdirectories contains any
571      :command:`install` rules, i.e. whether a ``make install``
572      or equivalent rule is available.
573
574    ``jsonFile``
575      A JSON string specifying a path relative to the codemodel file
576      to another JSON file containing a
577      `"codemodel" version 2 "directory" object`_.
578
579      This field was added in codemodel version 2.3.
580
581  ``projects``
582    A JSON array of entries corresponding to the top-level project
583    and sub-projects defined in the build system.  Each (sub-)project
584    corresponds to a source directory whose ``CMakeLists.txt`` file
585    calls the :command:`project` command with a project name different
586    from its parent directory.  The first entry corresponds to the
587    top-level project.
588
589    Each entry is a JSON object containing members:
590
591    ``name``
592      A string specifying the name given to the :command:`project` command.
593
594    ``parentIndex``
595      Optional member that is present when the project is not top-level.
596      The value is an unsigned integer 0-based index of another entry in
597      the main ``projects`` array that corresponds to the parent project
598      that added this project as a sub-project.
599
600    ``childIndexes``
601      Optional member that is present when the project has sub-projects.
602      The value is a JSON array of entries corresponding to the sub-projects.
603      Each entry is an unsigned integer 0-based index of another
604      entry in the main ``projects`` array.
605
606    ``directoryIndexes``
607      A JSON array of entries corresponding to build system directories
608      that are part of the project.  The first entry corresponds to the
609      top-level directory of the project.  Each entry is an unsigned
610      integer 0-based index into the main ``directories`` array.
611
612    ``targetIndexes``
613      Optional member that is present when the project itself has targets,
614      excluding those belonging to sub-projects.  The value is a JSON
615      array of entries corresponding to the targets.  Each entry is an
616      unsigned integer 0-based index into the main ``targets`` array.
617
618  ``targets``
619    A JSON array of entries corresponding to the build system targets.
620    Such targets are created by calls to :command:`add_executable`,
621    :command:`add_library`, and :command:`add_custom_target`, excluding
622    imported targets and interface libraries (which do not generate any
623    build rules).  Each entry is a JSON object containing members:
624
625    ``name``
626      A string specifying the target name.
627
628    ``id``
629      A string uniquely identifying the target.  This matches the ``id``
630      field in the file referenced by ``jsonFile``.
631
632    ``directoryIndex``
633      An unsigned integer 0-based index into the main ``directories`` array
634      indicating the build system directory in which the target is defined.
635
636    ``projectIndex``
637      An unsigned integer 0-based index into the main ``projects`` array
638      indicating the build system project in which the target is defined.
639
640    ``jsonFile``
641      A JSON string specifying a path relative to the codemodel file
642      to another JSON file containing a
643      `"codemodel" version 2 "target" object`_.
644
645"codemodel" version 2 "directory" object
646^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
647
648A codemodel "directory" object is referenced by a `"codemodel" version 2`_
649object's ``directories`` array.  Each "directory" object is a JSON object
650with members:
651
652``paths``
653  A JSON object containing members:
654
655  ``source``
656    A string specifying the path to the source directory, represented
657    with forward slashes.  If the directory is inside the top-level
658    source directory then the path is specified relative to that
659    directory (with ``.`` for the top-level source directory itself).
660    Otherwise the path is absolute.
661
662  ``build``
663    A string specifying the path to the build directory, represented
664    with forward slashes.  If the directory is inside the top-level
665    build directory then the path is specified relative to that
666    directory (with ``.`` for the top-level build directory itself).
667    Otherwise the path is absolute.
668
669``installers``
670  A JSON array of entries corresponding to :command:`install` rules.
671  Each entry is a JSON object containing members:
672
673  ``component``
674    A string specifying the component selected by the corresponding
675    :command:`install` command invocation.
676
677  ``destination``
678    Optional member that is present for specific ``type`` values below.
679    The value is a string specifying the install destination path.
680    The path may be absolute or relative to the install prefix.
681
682  ``paths``
683    Optional member that is present for specific ``type`` values below.
684    The value is a JSON array of entries corresponding to the paths
685    (files or directories) to be installed.  Each entry is one of:
686
687    * A string specifying the path from which a file or directory
688      is to be installed.  The portion of the path not preceded by
689      a ``/`` also specifies the path (name) to which the file
690      or directory is to be installed under the destination.
691
692    * A JSON object with members:
693
694      ``from``
695        A string specifying the path from which a file or directory
696        is to be installed.
697
698      ``to``
699        A string specifying the path to which the file or directory
700        is to be installed under the destination.
701
702    In both cases the paths are represented with forward slashes.  If
703    the "from" path is inside the top-level directory documented by the
704    corresponding ``type`` value, then the path is specified relative
705    to that directory.  Otherwise the path is absolute.
706
707  ``type``
708    A string specifying the type of installation rule.  The value is one
709    of the following, with some variants providing additional members:
710
711    ``file``
712      An :command:`install(FILES)` or :command:`install(PROGRAMS)` call.
713      The ``destination`` and ``paths`` members are populated, with paths
714      under the top-level *source* directory expressed relative to it.
715      The ``isOptional`` member may exist.
716      This type has no additional members.
717
718    ``directory``
719      An :command:`install(DIRECTORY)` call.
720      The ``destination`` and ``paths`` members are populated, with paths
721      under the top-level *source* directory expressed relative to it.
722      The ``isOptional`` member may exist.
723      This type has no additional members.
724
725    ``target``
726      An :command:`install(TARGETS)` call.
727      The ``destination`` and ``paths`` members are populated, with paths
728      under the top-level *build* directory expressed relative to it.
729      The ``isOptional`` member may exist.
730      This type has additional members ``targetId``, ``targetIndex``,
731      ``targetIsImportLibrary``, and ``targetInstallNamelink``.
732
733    ``export``
734      An :command:`install(EXPORT)` call.
735      The ``destination`` and ``paths`` members are populated, with paths
736      under the top-level *build* directory expressed relative to it.
737      The ``paths`` entries refer to files generated automatically by
738      CMake for installation, and their actual values are considered
739      private implementation details.
740      This type has additional members ``exportName`` and ``exportTargets``.
741
742    ``script``
743      An :command:`install(SCRIPT)` call.
744      This type has additional member ``scriptFile``.
745
746    ``code``
747      An :command:`install(CODE)` call.
748      This type has no additional members.
749
750    ``importedRuntimeArtifacts``
751      An :command:`install(IMPORTED_RUNTIME_ARTIFACTS)` call.
752      The ``destination`` member is populated. The ``isOptional`` member may
753      exist. This type has no additional members.
754
755    ``runtimeDependencySet``
756      An :command:`install(RUNTIME_DEPENDENCY_SET)` call or an
757      :command:`install(TARGETS)` call with ``RUNTIME_DEPENDENCIES``. The
758      ``destination`` member is populated. This type has additional members
759      ``runtimeDependencySetName`` and ``runtimeDependencySetType``.
760
761  ``isExcludeFromAll``
762    Optional member that is present with boolean value ``true`` when
763    :command:`install` is called with the ``EXCLUDE_FROM_ALL`` option.
764
765  ``isForAllComponents``
766    Optional member that is present with boolean value ``true`` when
767    :command:`install(SCRIPT|CODE)` is called with the
768    ``ALL_COMPONENTS`` option.
769
770  ``isOptional``
771    Optional member that is present with boolean value ``true`` when
772    :command:`install` is called with the ``OPTIONAL`` option.
773    This is allowed when ``type`` is ``file``, ``directory``, or ``target``.
774
775  ``targetId``
776    Optional member that is present when ``type`` is ``target``.
777    The value is a string uniquely identifying the target to be installed.
778    This matches the ``id`` member of the target in the main
779    "codemodel" object's ``targets`` array.
780
781  ``targetIndex``
782    Optional member that is present when ``type`` is ``target``.
783    The value is an unsigned integer 0-based index into the main "codemodel"
784    object's ``targets`` array for the target to be installed.
785
786  ``targetIsImportLibrary``
787    Optional member that is present when ``type`` is ``target`` and
788    the installer is for a Windows DLL import library file or for an
789    AIX linker import file.  If present, it has boolean value ``true``.
790
791  ``targetInstallNamelink``
792    Optional member that is present when ``type`` is ``target`` and
793    the installer corresponds to a target that may use symbolic links
794    to implement the :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION`
795    target properties.
796    The value is a string indicating how the installer is supposed to
797    handle the symlinks: ``skip`` means the installer should skip the
798    symlinks and install only the real file, and ``only`` means the
799    installer should install only the symlinks and not the real file.
800    In all cases the ``paths`` member lists what it actually installs.
801
802  ``exportName``
803    Optional member that is present when ``type`` is ``export``.
804    The value is a string specifying the name of the export.
805
806  ``exportTargets``
807    Optional member that is present when ``type`` is ``export``.
808    The value is a JSON array of entries corresponding to the targets
809    included in the export.  Each entry is a JSON object with members:
810
811    ``id``
812      A string uniquely identifying the target.  This matches
813      the ``id`` member of the target in the main "codemodel"
814      object's ``targets`` array.
815
816    ``index``
817      An unsigned integer 0-based index into the main "codemodel"
818      object's ``targets`` array for the target.
819
820  ``runtimeDependencySetName``
821    Optional member that is present when ``type`` is ``runtimeDependencySet``
822    and the installer was created by an
823    :command:`install(RUNTIME_DEPENDENCY_SET)` call. The value is a string
824    specifying the name of the runtime dependency set that was installed.
825
826  ``runtimeDependencySetType``
827    Optional member that is present when ``type`` is ``runtimeDependencySet``.
828    The value is a string with one of the following values:
829
830    ``library``
831      Indicates that this installer installs dependencies that are not macOS
832      frameworks.
833
834    ``framework``
835      Indicates that this installer installs dependencies that are macOS
836      frameworks.
837
838  ``scriptFile``
839    Optional member that is present when ``type`` is ``script``.
840    The value is a string specifying the path to the script file on disk,
841    represented with forward slashes.  If the file is inside the top-level
842    source directory then the path is specified relative to that directory.
843    Otherwise the path is absolute.
844
845  ``backtrace``
846    Optional member that is present when a CMake language backtrace to
847    the :command:`install` or other command invocation that added this
848    installer is available.  The value is an unsigned integer 0-based
849    index into the ``backtraceGraph`` member's ``nodes`` array.
850
851``backtraceGraph``
852  A `"codemodel" version 2 "backtrace graph"`_ whose nodes are referenced
853  from ``backtrace`` members elsewhere in this "directory" object.
854
855"codemodel" version 2 "target" object
856^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
857
858A codemodel "target" object is referenced by a `"codemodel" version 2`_
859object's ``targets`` array.  Each "target" object is a JSON object
860with members:
861
862``name``
863  A string specifying the logical name of the target.
864
865``id``
866  A string uniquely identifying the target.  The format is unspecified
867  and should not be interpreted by clients.
868
869``type``
870  A string specifying the type of the target.  The value is one of
871  ``EXECUTABLE``, ``STATIC_LIBRARY``, ``SHARED_LIBRARY``,
872  ``MODULE_LIBRARY``, ``OBJECT_LIBRARY``, ``INTERFACE_LIBRARY``,
873  or ``UTILITY``.
874
875``backtrace``
876  Optional member that is present when a CMake language backtrace to
877  the command in the source code that created the target is available.
878  The value is an unsigned integer 0-based index into the
879  ``backtraceGraph`` member's ``nodes`` array.
880
881``folder``
882  Optional member that is present when the :prop_tgt:`FOLDER` target
883  property is set.  The value is a JSON object with one member:
884
885  ``name``
886    A string specifying the name of the target folder.
887
888``paths``
889  A JSON object containing members:
890
891  ``source``
892    A string specifying the path to the target's source directory,
893    represented with forward slashes.  If the directory is inside the
894    top-level source directory then the path is specified relative to
895    that directory (with ``.`` for the top-level source directory itself).
896    Otherwise the path is absolute.
897
898  ``build``
899    A string specifying the path to the target's build directory,
900    represented with forward slashes.  If the directory is inside the
901    top-level build directory then the path is specified relative to
902    that directory (with ``.`` for the top-level build directory itself).
903    Otherwise the path is absolute.
904
905``nameOnDisk``
906  Optional member that is present for executable and library targets
907  that are linked or archived into a single primary artifact.
908  The value is a string specifying the file name of that artifact on disk.
909
910``artifacts``
911  Optional member that is present for executable and library targets
912  that produce artifacts on disk meant for consumption by dependents.
913  The value is a JSON array of entries corresponding to the artifacts.
914  Each entry is a JSON object containing one member:
915
916  ``path``
917    A string specifying the path to the file on disk, represented with
918    forward slashes.  If the file is inside the top-level build directory
919    then the path is specified relative to that directory.
920    Otherwise the path is absolute.
921
922``isGeneratorProvided``
923  Optional member that is present with boolean value ``true`` if the
924  target is provided by CMake's build system generator rather than by
925  a command in the source code.
926
927``install``
928  Optional member that is present when the target has an :command:`install`
929  rule.  The value is a JSON object with members:
930
931  ``prefix``
932    A JSON object specifying the installation prefix.  It has one member:
933
934    ``path``
935      A string specifying the value of :variable:`CMAKE_INSTALL_PREFIX`.
936
937  ``destinations``
938    A JSON array of entries specifying an install destination path.
939    Each entry is a JSON object with members:
940
941    ``path``
942      A string specifying the install destination path.  The path may
943      be absolute or relative to the install prefix.
944
945    ``backtrace``
946      Optional member that is present when a CMake language backtrace to
947      the :command:`install` command invocation that specified this
948      destination is available.  The value is an unsigned integer 0-based
949      index into the ``backtraceGraph`` member's ``nodes`` array.
950
951``link``
952  Optional member that is present for executables and shared library
953  targets that link into a runtime binary.  The value is a JSON object
954  with members describing the link step:
955
956  ``language``
957    A string specifying the language (e.g. ``C``, ``CXX``, ``Fortran``)
958    of the toolchain is used to invoke the linker.
959
960  ``commandFragments``
961    Optional member that is present when fragments of the link command
962    line invocation are available.  The value is a JSON array of entries
963    specifying ordered fragments.  Each entry is a JSON object with members:
964
965    ``fragment``
966      A string specifying a fragment of the link command line invocation.
967      The value is encoded in the build system's native shell format.
968
969    ``role``
970      A string specifying the role of the fragment's content:
971
972      * ``flags``: link flags.
973      * ``libraries``: link library file paths or flags.
974      * ``libraryPath``: library search path flags.
975      * ``frameworkPath``: macOS framework search path flags.
976
977  ``lto``
978    Optional member that is present with boolean value ``true``
979    when link-time optimization (a.k.a. interprocedural optimization
980    or link-time code generation) is enabled.
981
982  ``sysroot``
983    Optional member that is present when the :variable:`CMAKE_SYSROOT_LINK`
984    or :variable:`CMAKE_SYSROOT` variable is defined.  The value is a
985    JSON object with one member:
986
987    ``path``
988      A string specifying the absolute path to the sysroot, represented
989      with forward slashes.
990
991``archive``
992  Optional member that is present for static library targets.  The value
993  is a JSON object with members describing the archive step:
994
995  ``commandFragments``
996    Optional member that is present when fragments of the archiver command
997    line invocation are available.  The value is a JSON array of entries
998    specifying the fragments.  Each entry is a JSON object with members:
999
1000    ``fragment``
1001      A string specifying a fragment of the archiver command line invocation.
1002      The value is encoded in the build system's native shell format.
1003
1004    ``role``
1005      A string specifying the role of the fragment's content:
1006
1007      * ``flags``: archiver flags.
1008
1009  ``lto``
1010    Optional member that is present with boolean value ``true``
1011    when link-time optimization (a.k.a. interprocedural optimization
1012    or link-time code generation) is enabled.
1013
1014``dependencies``
1015  Optional member that is present when the target depends on other targets.
1016  The value is a JSON array of entries corresponding to the dependencies.
1017  Each entry is a JSON object with members:
1018
1019  ``id``
1020    A string uniquely identifying the target on which this target depends.
1021    This matches the main ``id`` member of the other target.
1022
1023  ``backtrace``
1024    Optional member that is present when a CMake language backtrace to
1025    the :command:`add_dependencies`, :command:`target_link_libraries`,
1026    or other command invocation that created this dependency is
1027    available.  The value is an unsigned integer 0-based index into
1028    the ``backtraceGraph`` member's ``nodes`` array.
1029
1030``sources``
1031  A JSON array of entries corresponding to the target's source files.
1032  Each entry is a JSON object with members:
1033
1034  ``path``
1035    A string specifying the path to the source file on disk, represented
1036    with forward slashes.  If the file is inside the top-level source
1037    directory then the path is specified relative to that directory.
1038    Otherwise the path is absolute.
1039
1040  ``compileGroupIndex``
1041    Optional member that is present when the source is compiled.
1042    The value is an unsigned integer 0-based index into the
1043    ``compileGroups`` array.
1044
1045  ``sourceGroupIndex``
1046    Optional member that is present when the source is part of a source
1047    group either via the :command:`source_group` command or by default.
1048    The value is an unsigned integer 0-based index into the
1049    ``sourceGroups`` array.
1050
1051  ``isGenerated``
1052    Optional member that is present with boolean value ``true`` if
1053    the source is :prop_sf:`GENERATED`.
1054
1055  ``backtrace``
1056    Optional member that is present when a CMake language backtrace to
1057    the :command:`target_sources`, :command:`add_executable`,
1058    :command:`add_library`, :command:`add_custom_target`, or other
1059    command invocation that added this source to the target is
1060    available.  The value is an unsigned integer 0-based index into
1061    the ``backtraceGraph`` member's ``nodes`` array.
1062
1063``sourceGroups``
1064  Optional member that is present when sources are grouped together by
1065  the :command:`source_group` command or by default.  The value is a
1066  JSON array of entries corresponding to the groups.  Each entry is
1067  a JSON object with members:
1068
1069  ``name``
1070    A string specifying the name of the source group.
1071
1072  ``sourceIndexes``
1073    A JSON array listing the sources belonging to the group.
1074    Each entry is an unsigned integer 0-based index into the
1075    main ``sources`` array for the target.
1076
1077``compileGroups``
1078  Optional member that is present when the target has sources that compile.
1079  The value is a JSON array of entries corresponding to groups of sources
1080  that all compile with the same settings.  Each entry is a JSON object
1081  with members:
1082
1083  ``sourceIndexes``
1084    A JSON array listing the sources belonging to the group.
1085    Each entry is an unsigned integer 0-based index into the
1086    main ``sources`` array for the target.
1087
1088  ``language``
1089    A string specifying the language (e.g. ``C``, ``CXX``, ``Fortran``)
1090    of the toolchain is used to compile the source file.
1091
1092  ``languageStandard``
1093    Optional member that is present when the language standard is set
1094    explicitly (e.g. via :prop_tgt:`CXX_STANDARD`) or implicitly by
1095    compile features.  Each entry is a JSON object with two members:
1096
1097    ``backtraces``
1098      Optional member that is present when a CMake language backtrace to
1099      the ``<LANG>_STANDARD`` setting is available.  If the language
1100      standard was set implicitly by compile features those are used as
1101      the backtrace(s).  It's possible for multiple compile features to
1102      require the same language standard so there could be multiple
1103      backtraces. The value is a JSON array with each entry being an
1104      unsigned integer 0-based index into the ``backtraceGraph``
1105      member's ``nodes`` array.
1106
1107    ``standard``
1108      String representing the language standard.
1109
1110    This field was added in codemodel version 2.2.
1111
1112  ``compileCommandFragments``
1113    Optional member that is present when fragments of the compiler command
1114    line invocation are available.  The value is a JSON array of entries
1115    specifying ordered fragments.  Each entry is a JSON object with
1116    one member:
1117
1118    ``fragment``
1119      A string specifying a fragment of the compile command line invocation.
1120      The value is encoded in the build system's native shell format.
1121
1122  ``includes``
1123    Optional member that is present when there are include directories.
1124    The value is a JSON array with an entry for each directory.  Each
1125    entry is a JSON object with members:
1126
1127    ``path``
1128      A string specifying the path to the include directory,
1129      represented with forward slashes.
1130
1131    ``isSystem``
1132      Optional member that is present with boolean value ``true`` if
1133      the include directory is marked as a system include directory.
1134
1135    ``backtrace``
1136      Optional member that is present when a CMake language backtrace to
1137      the :command:`target_include_directories` or other command invocation
1138      that added this include directory is available.  The value is
1139      an unsigned integer 0-based index into the ``backtraceGraph``
1140      member's ``nodes`` array.
1141
1142  ``precompileHeaders``
1143    Optional member that is present when :command:`target_precompile_headers`
1144    or other command invocations set :prop_tgt:`PRECOMPILE_HEADERS` on the
1145    target.  The value is a JSON array with an entry for each header.  Each
1146    entry is a JSON object with members:
1147
1148    ``header``
1149      Full path to the precompile header file.
1150
1151    ``backtrace``
1152      Optional member that is present when a CMake language backtrace to
1153      the :command:`target_precompile_headers` or other command invocation
1154      that added this precompiled header is available.  The value is an
1155      unsigned integer 0-based index into the ``backtraceGraph`` member's
1156      ``nodes`` array.
1157
1158    This field was added in codemodel version 2.1.
1159
1160  ``defines``
1161    Optional member that is present when there are preprocessor definitions.
1162    The value is a JSON array with an entry for each definition.  Each
1163    entry is a JSON object with members:
1164
1165    ``define``
1166      A string specifying the preprocessor definition in the format
1167      ``<name>[=<value>]``, e.g. ``DEF`` or ``DEF=1``.
1168
1169    ``backtrace``
1170      Optional member that is present when a CMake language backtrace to
1171      the :command:`target_compile_definitions` or other command invocation
1172      that added this preprocessor definition is available.  The value is
1173      an unsigned integer 0-based index into the ``backtraceGraph``
1174      member's ``nodes`` array.
1175
1176  ``sysroot``
1177    Optional member that is present when the
1178    :variable:`CMAKE_SYSROOT_COMPILE` or :variable:`CMAKE_SYSROOT`
1179    variable is defined.  The value is a JSON object with one member:
1180
1181    ``path``
1182      A string specifying the absolute path to the sysroot, represented
1183      with forward slashes.
1184
1185``backtraceGraph``
1186  A `"codemodel" version 2 "backtrace graph"`_ whose nodes are referenced
1187  from ``backtrace`` members elsewhere in this "target" object.
1188
1189"codemodel" version 2 "backtrace graph"
1190^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1191
1192The ``backtraceGraph`` member of a `"codemodel" version 2 "directory" object`_,
1193or `"codemodel" version 2 "target" object`_ is a JSON object describing a
1194graph of backtraces.  Its nodes are referenced from ``backtrace`` members
1195elsewhere in the containing object.  The backtrace graph object members are:
1196
1197``nodes``
1198  A JSON array listing nodes in the backtrace graph.  Each entry
1199  is a JSON object with members:
1200
1201  ``file``
1202    An unsigned integer 0-based index into the backtrace ``files`` array.
1203
1204  ``line``
1205    An optional member present when the node represents a line within
1206    the file.  The value is an unsigned integer 1-based line number.
1207
1208  ``command``
1209    An optional member present when the node represents a command
1210    invocation within the file.  The value is an unsigned integer
1211    0-based index into the backtrace ``commands`` array.
1212
1213  ``parent``
1214    An optional member present when the node is not the bottom of
1215    the call stack.  The value is an unsigned integer 0-based index
1216    of another entry in the backtrace ``nodes`` array.
1217
1218``commands``
1219  A JSON array listing command names referenced by backtrace nodes.
1220  Each entry is a string specifying a command name.
1221
1222``files``
1223  A JSON array listing CMake language files referenced by backtrace nodes.
1224  Each entry is a string specifying the path to a file, represented
1225  with forward slashes.  If the file is inside the top-level source
1226  directory then the path is specified relative to that directory.
1227  Otherwise the path is absolute.
1228
1229Object Kind "cache"
1230-------------------
1231
1232The ``cache`` object kind lists cache entries.  These are the
1233:ref:`CMake Language Variables` stored in the persistent cache
1234(``CMakeCache.txt``) for the build tree.
1235
1236There is only one ``cache`` object major version, version 2.
1237Version 1 does not exist to avoid confusion with that from
1238:manual:`cmake-server(7)` mode.
1239
1240"cache" version 2
1241^^^^^^^^^^^^^^^^^
1242
1243``cache`` object version 2 is a JSON object:
1244
1245.. code-block:: json
1246
1247  {
1248    "kind": "cache",
1249    "version": { "major": 2, "minor": 0 },
1250    "entries": [
1251      {
1252        "name": "BUILD_SHARED_LIBS",
1253        "value": "ON",
1254        "type": "BOOL",
1255        "properties": [
1256          {
1257            "name": "HELPSTRING",
1258            "value": "Build shared libraries"
1259          }
1260        ]
1261      },
1262      {
1263        "name": "CMAKE_GENERATOR",
1264        "value": "Unix Makefiles",
1265        "type": "INTERNAL",
1266        "properties": [
1267          {
1268            "name": "HELPSTRING",
1269            "value": "Name of generator."
1270          }
1271        ]
1272      }
1273    ]
1274  }
1275
1276The members specific to ``cache`` objects are:
1277
1278``entries``
1279  A JSON array whose entries are each a JSON object specifying a
1280  cache entry.  The members of each entry are:
1281
1282  ``name``
1283    A string specifying the name of the entry.
1284
1285  ``value``
1286    A string specifying the value of the entry.
1287
1288  ``type``
1289    A string specifying the type of the entry used by
1290    :manual:`cmake-gui(1)` to choose a widget for editing.
1291
1292  ``properties``
1293    A JSON array of entries specifying associated
1294    :ref:`cache entry properties <Cache Entry Properties>`.
1295    Each entry is a JSON object containing members:
1296
1297    ``name``
1298      A string specifying the name of the cache entry property.
1299
1300    ``value``
1301      A string specifying the value of the cache entry property.
1302
1303Object Kind "cmakeFiles"
1304------------------------
1305
1306The ``cmakeFiles`` object kind lists files used by CMake while
1307configuring and generating the build system.  These include the
1308``CMakeLists.txt`` files as well as included ``.cmake`` files.
1309
1310There is only one ``cmakeFiles`` object major version, version 1.
1311
1312"cmakeFiles" version 1
1313^^^^^^^^^^^^^^^^^^^^^^
1314
1315``cmakeFiles`` object version 1 is a JSON object:
1316
1317.. code-block:: json
1318
1319  {
1320    "kind": "cmakeFiles",
1321    "version": { "major": 1, "minor": 0 },
1322    "paths": {
1323      "build": "/path/to/top-level-build-dir",
1324      "source": "/path/to/top-level-source-dir"
1325    },
1326    "inputs": [
1327      {
1328        "path": "CMakeLists.txt"
1329      },
1330      {
1331        "isGenerated": true,
1332        "path": "/path/to/top-level-build-dir/.../CMakeSystem.cmake"
1333      },
1334      {
1335        "isExternal": true,
1336        "path": "/path/to/external/third-party/module.cmake"
1337      },
1338      {
1339        "isCMake": true,
1340        "isExternal": true,
1341        "path": "/path/to/cmake/Modules/CMakeGenericSystem.cmake"
1342      }
1343    ]
1344  }
1345
1346The members specific to ``cmakeFiles`` objects are:
1347
1348``paths``
1349  A JSON object containing members:
1350
1351  ``source``
1352    A string specifying the absolute path to the top-level source directory,
1353    represented with forward slashes.
1354
1355  ``build``
1356    A string specifying the absolute path to the top-level build directory,
1357    represented with forward slashes.
1358
1359``inputs``
1360  A JSON array whose entries are each a JSON object specifying an input
1361  file used by CMake when configuring and generating the build system.
1362  The members of each entry are:
1363
1364  ``path``
1365    A string specifying the path to an input file to CMake, represented
1366    with forward slashes.  If the file is inside the top-level source
1367    directory then the path is specified relative to that directory.
1368    Otherwise the path is absolute.
1369
1370  ``isGenerated``
1371    Optional member that is present with boolean value ``true``
1372    if the path specifies a file that is under the top-level
1373    build directory and the build is out-of-source.
1374    This member is not available on in-source builds.
1375
1376  ``isExternal``
1377    Optional member that is present with boolean value ``true``
1378    if the path specifies a file that is not under the top-level
1379    source or build directories.
1380
1381  ``isCMake``
1382    Optional member that is present with boolean value ``true``
1383    if the path specifies a file in the CMake installation.
1384
1385Object Kind "toolchains"
1386------------------------
1387
1388The ``toolchains`` object kind lists properties of the toolchains used during
1389the build.  These include the language, compiler path, ID, and version.
1390
1391There is only one ``toolchains`` object major version, version 1.
1392
1393"toolchains" version 1
1394^^^^^^^^^^^^^^^^^^^^^^
1395
1396``toolchains`` object version 1 is a JSON object:
1397
1398.. code-block:: json
1399
1400  {
1401    "kind": "toolchains",
1402    "version": { "major": 1, "minor": 0 },
1403    "toolchains": [
1404      {
1405        "language": "C",
1406        "compiler": {
1407          "path": "/usr/bin/cc",
1408          "id": "GNU",
1409          "version": "9.3.0",
1410          "implicit": {
1411            "includeDirectories": [
1412              "/usr/lib/gcc/x86_64-linux-gnu/9/include",
1413              "/usr/local/include",
1414              "/usr/include/x86_64-linux-gnu",
1415              "/usr/include"
1416            ],
1417            "linkDirectories": [
1418              "/usr/lib/gcc/x86_64-linux-gnu/9",
1419              "/usr/lib/x86_64-linux-gnu",
1420              "/usr/lib",
1421              "/lib/x86_64-linux-gnu",
1422              "/lib"
1423            ],
1424            "linkFrameworkDirectories": [],
1425            "linkLibraries": [ "gcc", "gcc_s", "c", "gcc", "gcc_s" ]
1426          }
1427        },
1428        "sourceFileExtensions": [ "c", "m" ]
1429      },
1430      {
1431        "language": "CXX",
1432        "compiler": {
1433          "path": "/usr/bin/c++",
1434          "id": "GNU",
1435          "version": "9.3.0",
1436          "implicit": {
1437            "includeDirectories": [
1438              "/usr/include/c++/9",
1439              "/usr/include/x86_64-linux-gnu/c++/9",
1440              "/usr/include/c++/9/backward",
1441              "/usr/lib/gcc/x86_64-linux-gnu/9/include",
1442              "/usr/local/include",
1443              "/usr/include/x86_64-linux-gnu",
1444              "/usr/include"
1445            ],
1446            "linkDirectories": [
1447              "/usr/lib/gcc/x86_64-linux-gnu/9",
1448              "/usr/lib/x86_64-linux-gnu",
1449              "/usr/lib",
1450              "/lib/x86_64-linux-gnu",
1451              "/lib"
1452            ],
1453            "linkFrameworkDirectories": [],
1454            "linkLibraries": [
1455              "stdc++", "m", "gcc_s", "gcc", "c", "gcc_s", "gcc"
1456            ]
1457          }
1458        },
1459        "sourceFileExtensions": [
1460          "C", "M", "c++", "cc", "cpp", "cxx", "mm", "CPP"
1461        ]
1462      }
1463    ]
1464  }
1465
1466The members specific to ``toolchains`` objects are:
1467
1468``toolchains``
1469  A JSON array whose entries are each a JSON object specifying a toolchain
1470  associated with a particular language. The members of each entry are:
1471
1472  ``language``
1473    A JSON string specifying the toolchain language, like C or CXX. Language
1474    names are the same as language names that can be passed to the
1475    :command:`project` command. Because CMake only supports a single toolchain
1476    per language, this field can be used as a key.
1477
1478  ``compiler``
1479    A JSON object containing members:
1480
1481    ``path``
1482      Optional member that is present when the
1483      :variable:`CMAKE_<LANG>_COMPILER` variable is defined for the current
1484      language. Its value is a JSON string holding the path to the compiler.
1485
1486    ``id``
1487      Optional member that is present when the
1488      :variable:`CMAKE_<LANG>_COMPILER_ID` variable is defined for the current
1489      language. Its value is a JSON string holding the ID (GNU, MSVC, etc.) of
1490      the compiler.
1491
1492    ``version``
1493      Optional member that is present when the
1494      :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable is defined for the
1495      current language. Its value is a JSON string holding the version of the
1496      compiler.
1497
1498    ``target``
1499      Optional member that is present when the
1500      :variable:`CMAKE_<LANG>_COMPILER_TARGET` variable is defined for the
1501      current language. Its value is a JSON string holding the cross-compiling
1502      target of the compiler.
1503
1504    ``implicit``
1505      A JSON object containing members:
1506
1507      ``includeDirectories``
1508        Optional member that is present when the
1509        :variable:`CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` variable is
1510        defined for the current language. Its value is a JSON array of JSON
1511        strings where each string holds a path to an implicit include
1512        directory for the compiler.
1513
1514      ``linkDirectories``
1515        Optional member that is present when the
1516        :variable:`CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES` variable is
1517        defined for the current language. Its value is a JSON array of JSON
1518        strings where each string holds a path to an implicit link directory
1519        for the compiler.
1520
1521      ``linkFrameworkDirectories``
1522        Optional member that is present when the
1523        :variable:`CMAKE_<LANG>_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES` variable
1524        is defined for the current language. Its value is a JSON array of JSON
1525        strings where each string holds a path to an implicit link framework
1526        directory for the compiler.
1527
1528      ``linkLibraries``
1529        Optional member that is present when the
1530        :variable:`CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES` variable is defined
1531        for the current language. Its value is a JSON array of JSON strings
1532        where each string holds a path to an implicit link library for the
1533        compiler.
1534
1535  ``sourceFileExtensions``
1536    Optional member that is present when the
1537    :variable:`CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS` variable is defined for
1538    the current language. Its value is a JSON array of JSON strings where each
1539    each string holds a file extension (without the leading dot) for the
1540    language.
1541