[cfe-dev] Building clang outside of LLVM (with CMake)

Óscar Fuentes ofv at wanadoo.es
Wed Feb 2 14:29:12 PST 2011

Douglas Gregor <dgregor at apple.com> writes:

> We'd like to be able to consider LLVM as a stable library that Clang
> depends on. This would allow us to build against an installed LLVM
> (rather than embedding our own full copy of LLVM in Clang), test Clang
> and LLVM more independently,

There are some configuration options (C_INCLUDE_DIRS,
CLANG_RESOURCE_DIR) which are stored on LLVM's config.h file.

The Right Thing is to create a config.h file for Clang, which is a task
a bit more obtrusive than I used to. It would consist on passing
-DHAVE_CLANG_CONFIG_H on the command line and adding

# include "clang/Config/config.h"

where necessary. This allows the autoconf build to remain unaffected.

The other possibility is to pass those options on the compiler's command
line, which is tricky because they can contain all sort of nasty

More information about the cfe-dev mailing list