cmake-file-api.7.rst 55 KB

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