如何使用 CLI 生成 JSON 编译数据库?

How can you generate a JSON compilation database using the CLI?

here 所述,可以使用 Visual Studio 的 UI 生成一个 JSON 编译数据库。是否可以在 CLI 中执行此操作?

(这个用例是使用带有 clangd 的数据库来为另一个编辑器提供自动完成功能)

显然有一个 powershell script 可以这样使用:

clang-build -export-jsondb

如果这会在当前目录下的项目的当前目录下生成一个compile_commands.json文件。