migrating from autoconf to cmake+ninja

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

prefix = CMAKE_INSTALL_PREFIX
enabled-shared = BUILD_SHARED_LIBS
targets = LLVM_TARGETS_TO_BUILD (defaults to all, or use a semicolon separated list)
disable-assertions = LLVM_ENABLE_ASSERTIONS (obviously inverted :wink:

I don't believe the others have direct equivalents, however debug/optimized is chosen via CMAKE_BUILD_TYPE

prefix = CMAKE_INSTALL_PREFIX
enabled-shared = BUILD_SHARED_LIBS
targets = LLVM_TARGETS_TO_BUILD (defaults to all, or use a semicolon separated list)
disable-assertions = LLVM_ENABLE_ASSERTIONS (obviously inverted :wink:

I don't believe the others have direct equivalents, however debug/optimized is chosen via CMAKE_BUILD_TYPE

Thank you. I found
http://llvm.org/docs/CMake.html#options-and-variables and gonna
try out cmake -G ninja.

It worked and "ninja install" put the stuff in the right target directory but
clang-analyzer is not there. Does anybody know why that happened
with a Cmake build?

It worked and "ninja install" put the stuff in the right target directory but
clang-analyzer is not there. Does anybody know why that happened
with a Cmake build?

I've never used the clang-analyzer but I presume you're talking about
the stuff in ``tools/scan-view`` and ``tools/scan-build``? There's no
CMakeLists.txt files in those directories and I can't find any
CMakeLists.txt files that reference those directories. The
Autoconf/Makefile build system doesn't seem to touch them either so
maybe I'm looking at the wrong thing.

You're right I was copying it in a separate step in my ./configure based
build script. But how does everyone else install the clang-anlyzer tools?
I also manually create symlinks for bin/scan-view, bin/scan-build.

You're right I was copying it in a separate step in my ./configure based
build script. But how does everyone else install the clang-anlyzer tools?
I also manually create symlinks for bin/scan-view, bin/scan-build.

It might be better to ask on the clang mailing list about this.

Just as a side note it should be very easy to teach the CMake build
system to install the scan-view and scan-build scripts. I'm not sure
if people in general want this though.

Thanks,
Dan.

It might be better to ask on the clang mailing list about this.

I've copied over my copy and python compile bit from the old build
script and it works.

Maybe I'll post on that list too.

Just as a side note it should be very easy to teach the CMake build
system to install the scan-view and scan-build scripts. I'm not sure
if people in general want this though.

How do others install clang-analyzer is what's interesting or if it's
deprecated in favor of something new that's pure C++.