How to generate compile_commands.json for a C ++ Bazel project

In a C ++ Bazel project, I want to use tools like Clang Tools or RTags , etc.

To do this, I need to generate the file file compile_commands.json .

The solution is trivial for CMake with CMAKE_EXPORT_COMPILE_COMMANDS .

For simple Make files, you can still use the Bear tool .

However, AFAIK does not have a built-in solution for C ++ Bazel projects.

+4
source share
1 answer

Additional Information:

  • Bear Bazel:
  • compile_command.json .

:

, , gist: compile_commands.json Bazel.

, bash < -

:

GitHub :

+3

Source: https://habr.com/ru/post/1680943/


All Articles