cmake-file-api.7.rst 64 KB

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