Is there a LLVM type backend for build systems?

Hi all,

Every company I work for that deals in C++ seems to use a different build system stack, and quite a few want to switch away from what they are currently using!

I have often wondered about ways to automate the conversion process. I have certainly seen an MSBuild to CMake converter before, but I seem to remember it’s not well maintained, and ofc CMake can easily convert to a build system it targets.

I’m wondering if anyone knows of an LLVM type backend thing which abstracts away from specific build systems and produces maybe some kind of abstract syntax tree type thing that can be easily consumed by front ends to convert to whatever build system/build system generator people may want.

In my head CMake is a good candidate for the generation part of this system in my head because… well that’s what it does! But getting build systems converted into a CMakeLists.txt structure seems a little complex, especially with CMake potentially being able to change syntax whenever. Hence the desire for some abstract graph type representation.

This may not have been written too well, it’s a bit of a mind dump, and I’m sorry for that. But any input would be appreciated, just spitballing.

1 Like

some kind of abstract syntax tree type thing that can be easily consumed by front ends to convert to whatever build system/build system generator people may want

LLVM itself specifies a compile_commands.json format, which CMake can also generate. (It consists of just a flat list of the final expanded command lines, without the notion of variables or hierarchy or dependencies.)

There’s also the Ninja format (which CMake can generate) — a minimalist, structured representation of the steps necessary to perform a build.

1 Like