CMAKE_EXPORT_COMPILE_COMMANDS.rst 809 B

123456789101112131415161718192021222324252627282930
  1. CMAKE_EXPORT_COMPILE_COMMANDS
  2. -----------------------------
  3. Enable/Disable output of compile commands during generation.
  4. If enabled, generates a ``compile_commands.json`` file containing the exact
  5. compiler calls for all translation units of the project in machine-readable
  6. form. The format of the JSON file looks like:
  7. .. code-block:: javascript
  8. [
  9. {
  10. "directory": "/home/user/development/project",
  11. "command": "/usr/bin/c++ ... -c ../foo/foo.cc",
  12. "file": "../foo/foo.cc"
  13. },
  14. ...
  15. {
  16. "directory": "/home/user/development/project",
  17. "command": "/usr/bin/c++ ... -c ../foo/bar.cc",
  18. "file": "../foo/bar.cc"
  19. }
  20. ]
  21. .. note::
  22. This option is implemented only by :ref:`Makefile Generators`
  23. and the :generator:`Ninja`. It is ignored on other generators.