cmake-parser
A lot of the C and C++ world describes itself in CMake. If a tool needs to know what a project builds — targets, sources, flags — the honest way is to parse those files rather than pattern-match them.
What changes for you
- Commands and arguments as structures, with positions and errors, instead of a wall of text.
- The documented language (3.26) rather than one project's habits.
- Usable in generators and linters: inspect a build, migrate a setting, answer "which targets exist".
Getting it
cargo add cmake-parseruse cmake_parser::parse_cmakelists;
for command in parse_cmakelists(text)? {
// command.name, command.arguments, ...
}