Clang-format IncludeCategories and quotes vs. brackets

clang-format allows the reordering and regrouping of includes, but does not touch the distinction between #include "" and #include <>, even though some projects may also want to uniformize this. While GCC and clang have the distinct flags -isystem, -iquote and -I, CMake only supports -isystem and -I, and I don’t expect this to change in the near future, so I would suggest for the ambiguous -I paths to add another configuration option IncludeStyle: quotes|brackets to automatically fix these issues. Since this might theoretically break code during formatting, I wanted to discuss it here first.

The context where this came up was with clangd’s include fixup, which always uses double quotes for includes unless they are found in -isystem paths. While this is usually the case for libraries that are installed system-wide, it is not true for library development and similar cases. I don’t think clangd is necessary the right place to tackle this.

There is an issue for this though: First-class support for GNU -iquote, -I- and -I=opt/foo include directory specifiers (#15491) · Issues · CMake / CMake · GitLab

I saw that too, but I think this is not necessarily the right place to tackle it, as the choice whether to use <> or “” is more of a style question than a build configuration question in this context. Also the use might differ from library developer viewpoint vs. library user viewpoint, but both would use the same include flags if they get propagated by CMake.

Note that C++20 header units may care about the symbols and name used to lookup headers depending on how the build system and compiler end up overlapping in support.