cmake-file-api.7.rst 74 KB

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