Using result of config-ix in custom tool.

[CCing llvm-dev]

arrowdodger <> writes:

Hello. Suppose i'm writing a tool, which uses LLVM and i want it to be
buildable like clang - from tools/ subdir or standalone build. Since i'm not
very experinced with CMake, i've took your code from clang and tried to
adapt it. Now i stumbled upon this problem - i can't use result of running
config-ix.cmake if i'm building my tool standalone.
The reason i want do this is that my config.h shares quite a lot of defines
with LLVM's one. But as i can see from your code, clang don't use them too,
just defines some of his own.
So, should i write my own config-ix.cmake for my tool, or i've missed

On the long term, I think that the best route is to have your own
config-ix.cmake (the -ix part is a remnant from the times where there
was a config-w32.cmake too) LLVM's config-ix.cmake can change any time,
tests may be added, changed, removed, there is lots of chances for name
clashes with your cmake files, etc.

OTOH, if you just want to use the macros defined by the platform tests
on your C++ source code, #including llvm/Config/config.h will work, if
you don't care about the occassional breakage introduced by the changes
mentioned above.