<div dir="ltr"><div>This might help you get started (this is for out of tree pointing to my development build, but you could also point to the installed version if you have one).</div><div><br></div><div># if you only have/need LLVM:</div><div># export LLVM_DIR=/Users/dhinton/projects/llvm_project/build/Debug/lib/cmake/llvm</div><div># if you also have/need clang:</div><div># export CLANG_DIR=/Users/dhinton/projects/llvm_project/build/Debug/lib/cmake/clang</div><div><br></div><div># While just setting LLVM_DIR will make find_package work, you need to</div><div># add it to CMAKE_MODULE_PATH if you want to include AddLLVM, e.g., if</div><div># you want to use add_llvm_loadable_module.</div><div>set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{LLVM_DIR};$ENV{Clang_DIR}")</div><div>#find_package(LLVM REQUIRED CONFIG)</div><div>find_package(Clang REQUIRED CONFIG)</div><div>include(AddLLVM)</div><div>add_definitions(${LLVM_DEFINITIONS})</div><div>include_directories(${LLVM_INCLUDE_DIRS})</div><div>include_directories(${CLANG_INCLUDE_DIRS})</div><div>link_directories(${LLVM_LIBRARY_DIRS})</div><div><br></div><div>message("LLVM_DEFINITIONS = ${LLVM_DEFINITIONS}")</div><div>message("LLVM_INCLUDE_DIRS = ${LLVM_INCLUDE_DIRS}")</div><div>message("LLVM_LIBRARY_DIRS = ${LLVM_LIBRARY_DIRS}")</div><div>message("CLANG_INCLUDE_DIRS = ${CLANG_INCLUDE_DIRS}")</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 4, 2017 at 11:39 AM, Kim Gräsman via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
In include-what-you-use, we recently had this bug report:<br>
<a href="https://github.com/include-what-you-use/include-what-you-use/pull/465" rel="noreferrer" target="_blank">https://github.com/include-<wbr>what-you-use/include-what-you-<wbr>use/pull/465</a><br>
<br>
And it's symptomatic for a whole class of problems where we're<br>
duplicating knowledge from the LLVM/Clang CMake systems to allow both<br>
in-tree and out-of-tree IWYU development.<br>
<br>
(in our terminology, in-tree == cloning the include-what-you-use repo<br>
into a full LLVM and Clang checkout/clone under<br>
llvm/tools/clang/tools/<wbr>include-what-you-use and out-of-tree == cloning<br>
include-what-you-use anywhere, and giving CMake information about<br>
where to find LLVM/Clang headers and libraries)<br>
<br>
Looking around my system, I see a lot of CMake modules in<br>
/usr/lib/llvm-4.0 and /usr/share/llvm-4.0, but it's not clear to me<br>
how to use them. Also, it would be nice to allow a "next-to-tree"<br>
configuration instead of in-tree, where I can point IWYU at a trunk<br>
checkout of LLVM and Clang and use its CMake modules.<br>
<br>
Is there a correct way to accomplish this?<br>
<br>
Thanks,<br>
- Kim<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>