difficulties compiling LLVM with CMake

For my language front-end I'm using a version of LLVM (2.3) that I
have modified to compile with CMake.
But it doesn't work as supposed to.

A little background. I have split the files from "lib/" into four libraries:
  1) llvmsystem: contains the files from "System/"
  2) llvmsupport: contains the files from "Support/"
  3) llvmcore: contains the files from "VMCore/"
  4) llvmother: contains everything else, except "ExecutionEngine" as
I don't need that (and some newer targets I don't compile yet)

I also compile some of the tools, like "llc".

If I compile the libraries as static ones, then llc doesn't work
because it cannot find any registered targets. So I had to compile
them as shared libraries, but now I get a warning when linking

Linking CXX shared library libllvmother.so
warning: creating a DT_TEXTREL in object.

In this configuration the libraries and tools work, except that the
tools produce some error output before doing their job:

$ ./compiler/llvm/tools/llc/llc --version
<premain>: CommandLine Error: Argument 'inline-threshold' defined more
than once!
llc: CommandLine Error: Argument 'inline-threshold' defined more than once!
Low Level Virtual Machine (http://llvm.org/):
  llvm version 2.3
  DEBUG build with assertions.

Can anyone help me fix these issues? Most important now is getting rid
of the DT_TEXTREL, because that doesn't work on x86_64.
I have attached a patch for LLVM 2.3 in case it is useful for finding
out what I'm doing wrong.

Kevin André

llvm2.3-with-CMake.diff (60.1 KB)