[LLVMdev] migrating from autoconf to cmake+ninja

Carsten Mattner
Wed, 27 Aug 2014 13:40:51 -0000

I want to start using cmake+ninja instead of autoconf for configuring
and building llvm from svn, but I have no idea how to map my existing
list of autoconf flags to cmake.

Here's how I run ./configure right now in the top directory:
PREFIX=_some_prefix_dir_ \
    ../llvm/configure \
    --prefix=$PREFIX \
    --libdir=$PREFIX/lib/llvm \
    --sysconfdir=$PREFIX/etc \
    --enable-shared \
    --enable-targets=all \
    --disable-expensive-checks \
    --disable-debug-runtime \
    --disable-assertions \
    --with-binutils-include=/usr/include \
    --enable-optimized

Is it possible to map this to cmake flags and if yes how?

Platform is linux-x86_64 and revision is release_35 branch.

If there's superfluous flags please do tell and I'll remove them.

Also is there a flag to skip tests?

Is building lld on linux supported? I tried including lld in the build
and it failed:
llvm[4]: Linking Release unit test CoreTest (without symbols)
/tmp/llvm/build/Release/lib/libgtest_main.a(TestMain.o): In function `main':
/tmp/llvm/llvm/utils/unittest/UnitTestMain/TestMain.cpp:(.text.main+0x28):
undefined reference to `llvm::cl::ParseCommandLineOptions(int, char
const* const*, char const*)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/tmp/llvm/llvm/unittests/Makefile.unittest:58: recipe for target
'Release/CoreTestTests' failed
make[4]: *** [Release/CoreTestTests] Error 1
make[4]: Leaving directory
'/tmp/llvm/build/tools/lld/unittests/CoreTests'
/tmp/llvm/llvm/Makefile.rules:937: recipe for target
'CoreTests/.makeall' failed
make[3]: *** [CoreTests/.makeall] Error 2