# clang-format integration

**URL:** <https://discourse.cmake.org/t/clang-format-integration/3358>\
**Category:** Code\
**Tags:** comp:clang\
**Created:** [May 18, 2021, 7:44am UTC](https://discourse.cmake.org/t/clang-format-integration/3358 "2021-05-18T07:44:43Z")\
**Posts on this page:** 1\
**Showing post:** 6

<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:** [May 19, 2021, 1:01pm UTC](https://discourse.cmake.org/t/clang-format-integration/3358/6 "2021-05-19T13:01:35Z")

</div>

I suppose a module could be developed to do this. Something like `clang_format_add_rules(TARGETS tgt1 tgt2)` with a `clang_format_add_target(NAME clang-format)`. I really don’t know about doing it by default like Meson is doing it because `clang-format` is _terrible_ with compatibility across versions (e.g., if one dev has `clang-format-8` and another `clang-format-9`, there’s likely to be _lots_ of noise generated as each ends up running it).

---

_[View the full topic](https://discourse.cmake.org/t/clang-format-integration/3358)._
