Building LLVM and clang with different options

I'm trying to build LLVM with a build type of MinSizeRel and clang with a
build type of Debug. I've cloned llvm and clang (into llvm/tools/clang),
created a build directory parallel to llvm and from it, and invoked 'cmake
-G "Unix Makefiles" ../llvm'. I changed (in build/CMakeCache.txt)
CMAKE_BUILD_TYPE to MinSizeRel and ran make - both LLVM and clang are built
successfully. I now want to build clang in Debug mode, but don't see any
obvious way of doing this - changing the CMAKE_BUILD_TYPE to Debug causes
LLVM to be rebuilt in Debug mode, too. Is there an easy way to do this via
CMake, or is some other approach required?

Regards,

Vinay Sajip

In general, this is too difficult to be worth the trouble. You can attempt it by doing a standalone build, where you install LLVM to some local prefix, checkout clang separately outside of llvm, put LLVM’s bin directory on PATH, and try to configure it that way.

I do as Reid describes. I build a “release” build that I install into /usr/local/… and then a debug build that I install into a different directory. When I then build my own project (that uses LLVM), I use the /usr/local version to perform the build, but use the debug build for the libraries and headers, such that I get the debug info and asserts that help me tell me what I’ve done wrong (inevitably I do several times for each new feature I’m implementing).

Reid and Mats,

Thanks for the feedback. Shame it isn't easier - I would have thought it a
common use case for e.g. people hacking on the just the front-end parts of
clang (I'm working with libclang, and AFAICT I shouldn't need to delve into
the LLVM layer at any point for e.g. just parsing code).

Regards,

Vinay Sajip