cmake hack: make headers available in IDE/qtcreator

Hi,

this is a quick hack I figure could be helpful to others to make llvm
and clang headers visible to qt creator. Just add the following to
CMakeLists.txt of clang:

# Generate a list of LLVM and Clang headers.
file(GLOB_RECURSE ALL_CLANG_HEADERS include/*.h)
file(GLOB_RECURSE ALL_LLVM_HEADERS ../../include/*.h)
set(ALL_HEADERS "${ALL_CLANG_HEADERS}" "${ALL_LLVM_HEADERS}")

# Add a custom dummy target that uses all headers as source.
add_custom_target(header_dummy_target SOURCES "${ALL_HEADERS}")

Now qt creator should find the headers when using locator. Might be
useful for other IDEs as well (Eclipse CDT ?).

Regards,
Georg

What do you mean by “make headers visible to qt creator”? I’m using qt creator and open CMakeList file directly, I haven’t noticed that anything is missing.

The headers are not accessible via locate (ctrl-k). Does this work for you?
The include path is good, that is I can follow headers with F2 without
using the hack.

Regards,
Georg

I can’t believe I never noticed this :stuck_out_tongue: