# How to add clang-tidy to open source project?

**URL:** https://discourse.cmake.org/t/how-to-add-clang-tidy-to-open-source-project/7311
**Category:** Usage
**Created:** [January 23, 2023, 10:05pm UTC](https://discourse.cmake.org/t/how-to-add-clang-tidy-to-open-source-project/7311 "2023-01-23T22:05:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [January 23, 2023, 10:05pm UTC](https://discourse.cmake.org/t/how-to-add-clang-tidy-to-open-source-project/7311/1 "2023-01-23T22:05:39Z")

</div>

CMake currently has built in clang-tidy support via:  
-[\<LANG\>\_CLANG\_TIDY](https://cmake.org/cmake/help/latest/prop_tgt/LANG_CLANG_TIDY.html)

However, it only works on the Makefile / Ninja generator:

> The [Makefile Generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#makefile-generators) and the [`Ninja`](https://cmake.org/cmake/help/latest/generator/Ninja.html#generator:Ninja) generator will run this tool along with the compiler and report a warning if the tool reports any problems.

Wouldn’t this cause workflow issues for Visual Studio / XCode users?

I work on a decently popular open source project and want to ensure a smooth workflow for as much developers as possible.

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [January 23, 2023, 10:12pm UTC](https://discourse.cmake.org/t/how-to-add-clang-tidy-to-open-source-project/7311/2 "2023-01-23T22:12:38Z")

</div>

AFAIK, the VS and XCode buildsystems don’t support running arbitrary commands to compile a file, which is required to run `clang-tidy`. This is beyond our control. If someone can figure out an alternate method of supporting `clang-tidy` in these generators, that would be welcome.

For now, to support the widest range of users and the easiest setup, I’d recommend using Ninja. It’s supported on every platform that CMake supports, and is easy to install.
