blob: a7e9029dc4f7be964b54eac0615db24f1da13be5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
CMAKE_EXPORT_COMPILE_COMMANDS
-----------------------------
.. versionadded:: 3.5
Enable/Disable output of compile commands during generation.
If enabled, generates a ``compile_commands.json`` file containing the exact
compiler calls for all translation units of the project in machine-readable
form. The format of the JSON file looks like:
.. code-block:: javascript
[
{
"directory": "/home/user/development/project",
"command": "/usr/bin/c++ ... -c ../foo/foo.cc",
"file": "../foo/foo.cc"
},
...
{
"directory": "/home/user/development/project",
"command": "/usr/bin/c++ ... -c ../foo/bar.cc",
"file": "../foo/bar.cc"
}
]
This is initialized by the :envvar:`CMAKE_EXPORT_COMPILE_COMMANDS` environment
variable, and initializes the :prop_tgt:`EXPORT_COMPILE_COMMANDS` target
property for all targets.
.. note::
This option is implemented only by :ref:`Makefile Generators`
and :ref:`Ninja Generators`. It is ignored on other generators.
This option currently does not work well in combination with
the :prop_tgt:`UNITY_BUILD` target property or the
:variable:`CMAKE_UNITY_BUILD` variable.
|