Formatting tool for CMake language
I am willing to implement the feature described below and curious about opinions.
The idea is to make a tool for formatting CMake files similar to ClangFormat. It would be a separate executable (cmake-format ?) which would read configuration file (.cmake-format) and apply formatting defined in it. Configuration file would be placed in the same location as CMakeLists.txt. If not present, formatting as in parent CMakeLists.txt would be applied.
The idea of implementation is pretty simple. We need parser and generator. CMakeLists.txt file is parsed to AST (Abstract Syntax Tree) and then from it new formatted output is generated with applied rules from configuration file. The most difficult part is decoupling of CMake commands parsing and execution, which I moved to another issue #19958 , since it could be prerequisite for some other feature requests.