1 CMAKE_EXPORT_COMPILE_COMMANDS
2 -----------------------------
6 Enable/Disable output of compile commands during generation.
8 If enabled, generates a ``compile_commands.json`` file containing the exact
9 compiler calls for all translation units of the project in machine-readable
10 form. The format of the JSON file looks like:
12 .. code-block:: javascript
16 "directory": "/home/user/development/project",
17 "command": "/usr/bin/c++ ... -c ../foo/foo.cc",
18 "file": "../foo/foo.cc"
24 "directory": "/home/user/development/project",
25 "command": "/usr/bin/c++ ... -c ../foo/bar.cc",
26 "file": "../foo/bar.cc"
30 This is initialized by the :envvar:`CMAKE_EXPORT_COMPILE_COMMANDS` environment
31 variable, and initializes the :prop_tgt:`EXPORT_COMPILE_COMMANDS` target
32 property for all targets.
35 This option is implemented only by :ref:`Makefile Generators`
36 and the :generator:`Ninja`. It is ignored on other generators.
38 This option currently does not work well in combination with
39 the :prop_tgt:`UNITY_BUILD` target property or the
40 :variable:`CMAKE_UNITY_BUILD` variable.