Answer: With CMake, you can generate compile_commands.json automatically by adding the line set(CMAKE_EXPORT_COMPILE_COMMANDS ON) to your CMakeLists.txt. After building your project, CMake will generate the compile_commands.json file in the build directory and clangd will automatically pick it up. Status: Overdue (check was due 2026-11-20T13:41:41Z and has not succeeded) Entry: tool/zed/settings/compile-commands-setup Revision: 1 Digest: sha256:a104d2b11929413f (changes whenever the content changes) Timeline: Created: 2026-11-13T04:03:14Z Last changed: 2026-11-13T04:03:14Z Last verified: 2026-11-19T13:41:41Z Next check: 2026-11-20T13:41:41Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of CMake setting | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | [1] | 2026-11-19 Generated file | compile_commands.json | [1] | 2026-11-19 File location | build directory | [1] | 2026-11-19 Sources: [1] Zed Industries. "zed.dev/docs/languages/cpp.md". https://zed.dev/docs/languages/cpp.md Role: primary. Accessed: 2026-11-19T13:41:41Z Quote: "set(CMAKE_EXPORT_COMPILE_COMMANDS ON)" (Supports: CMake setting) Quote: "CMake will generate the `compile_commands.json` file in the build directory" (Supports: Generated file) Quote: "generate the `compile_commands.json` file in the build directory" (Supports: File location) Snapshot SHA-256: cef17ad7aa053bb70c0421072c6fb0187bb9c665d97b3e2647ce2988c813a698 (captured 2026-11-13T04:03:11Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T04:03:14Z, so the values verified then were kept. Cross-check: not-available at 2026-11-19T13:41:41Z. No independent second source is configured for this entry Last successful check: 2026-11-19T13:41:41Z Last attempt: 2026-11-19T13:41:41Z Notes and limitations: Extracted automatically from a single official source (section "Compile Commands"). Human-readable page: https://zed.dev/docs/languages/cpp.html Related: https://latestn.com/tool/zed/settings/configure-air-formatter How do I configure the Air formatter for R in Zed? https://latestn.com/tool/zed/settings/configure-broad-worktree-trust How do I configure broad worktree trust in Zed? https://latestn.com/tool/zed/settings/configure-c-formatting How do I configure C code formatting in Zed? https://latestn.com/tool/zed/settings/clangd-arguments How do I pass arguments to clangd in Zed? https://latestn.com/tool/zed/settings/cli-environment-variables How does Zed get environment variables when launched from the CLI? https://latestn.com/tool/zed/settings/commit-line-length How do I configure the commit message line length in Zed? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T04:03:14Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/zed/settings/compile-commands-setup/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/zed/settings/compile-commands-setup POST: https://latestn.com/dispute/tool/zed/settings/compile-commands-setup with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/zed/settings/compile-commands-setup?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I set up compile commands for C++ in Zed? Revision 1, last verified 2026-11-19T13:41:41Z. https://latestn.com/tool/zed/settings/compile-commands-setup (accessed 2026-11-21T09:54:16Z). @misc{LatestN_tool_zed_settings_compile_commands_setup_r1, title = {How do I set up compile commands for C++ in Zed?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/zed/settings/compile-commands-setup}}, note = {Revision 1; digest sha256:a104d2b11929413f; last verified 2026-11-19T13:41:41Z; accessed 2026-11-21T09:54:16Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/zed/settings/compile-commands-setup