# Exclude paths for compile\_commands.json

**URL:** https://discourse.cmake.org/t/exclude-paths-for-compile-commands-json/4082
**Category:** Usage
**Tags:** os:windows, gen:ninja, gen:makefiles
**Created:** [September 14, 2021, 5:43am UTC](https://discourse.cmake.org/t/exclude-paths-for-compile-commands-json/4082 "2021-09-14T05:43:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Krishna](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/71c47a/32.png) [@Krishna](https://discourse.cmake.org/u/Krishna)
#### Post date: [September 14, 2021, 5:43am UTC](https://discourse.cmake.org/t/exclude-paths-for-compile-commands-json/4082/1 "2021-09-14T05:43:51Z")

</div>

Hi,

We are generating compile\_commands.json using CMAKE\_EXPORT\_COMPILE\_COMMANDS in CMake for passing to cppcheck tool. Now we would like to exclude some paths which we don’t want to see in the database file.  
How to set in CMake to exclude paths in the compile\_commands.json?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 14, 2021, 12:49pm UTC](https://discourse.cmake.org/t/exclude-paths-for-compile-commands-json/4082/2 "2021-09-14T12:49:10Z")

</div>

There’s no way to do that today. Feel free to file [a feature request](https://gitlab.kitware.com/cmake/cmake/-/issues).

---

<div class="post-metadata">

### Author: ![Krishna](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/71c47a/32.png) [@Krishna](https://discourse.cmake.org/u/Krishna)
#### Post date: [September 14, 2021, 2:56pm UTC](https://discourse.cmake.org/t/exclude-paths-for-compile-commands-json/4082/3 "2021-09-14T14:56:48Z")

</div>

Thanks for the reply Ben.  
I’ll find an alternative.

Thanks.
