# How to export compile commands?

**URL:** <https://discourse.slicer.org/t/how-to-export-compile-commands/31410>\
**Category:** Development\
**Tags:** build, cmake\
**Created:** [August 28, 2023, 8:39pm UTC](https://discourse.slicer.org/t/how-to-export-compile-commands/31410 "2023-08-28T20:39:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![somso2e](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@somso2e](https://discourse.slicer.org/u/somso2e)\
**Post date:** [August 28, 2023, 8:39pm UTC](https://discourse.slicer.org/t/how-to-export-compile-commands/31410/1 "2023-08-28T20:39:47Z")

</div>

Hi clangd depends on the compile\_commands.json file to work but I can’t generate it by setting the `CMAKE_EXPORT_COMPILE_COMMANDS` flag like below.

```auto
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON Slicer-SuperBuild-Debug/

```

---

<div class="post-metadata">

**Author:** ![somso2e](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@somso2e](https://discourse.slicer.org/u/somso2e)\
**Post date:** [October 13, 2023, 9:24am UTC](https://discourse.slicer.org/t/how-to-export-compile-commands/31410/2 "2023-10-13T09:24:56Z")

</div>

I just needed to run make as well and the file was generated.
