Building LLVM with CMake


Attached is an experimental patch for LLVM (version 1.9) that enables
it to be built with CMake. The patch can currently only compile the
library, it cannot compile the tools yet. When linking the first tool
(llc) I get link errors about symbols from libtool which I'm not
familiar with. Installing compiled files is not supported yet. It's
actually a quick-and-dirty version right now. I have only tested it on
Linux and the CMakeLists.txt contains some definitions of things that
should actually be detected. There are some include files and config
files that I needed to modify so this has probably broken the regular
LLVM build system, but this can be fixed. I am relatively new to CMake
so there are probably things that could be improved. If you are
familiar enough with CMake, feel free to improve the patch :wink:

The reason for me wanting to use CMake for LLVM is that I already
CMake it to build my language front end, and I didn't want to switch
to autoconf just to be able to use LLVM with it. And maybe it could be
a nice new feature for LLVM 2.0 to have an alternative build system

LLVM_CMake.diff (50.7 KB)