[cfe-dev] Out-of-tree CMake dependencies
Don Hinton via cfe-dev
cfe-dev at lists.llvm.org
Wed Oct 4 12:34:17 PDT 2017
s/CLANG_DIR/Clang_DIR/
On Wed, Oct 4, 2017 at 12:31 PM, Don Hinton <hintonda at gmail.com> wrote:
> 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).
>
> # if you only have/need LLVM:
> # export LLVM_DIR=/Users/dhinton/projects/llvm_project/build/
> Debug/lib/cmake/llvm
> # if you also have/need clang:
> # export CLANG_DIR=/Users/dhinton/projects/llvm_project/build/
> Debug/lib/cmake/clang
>
> # While just setting LLVM_DIR will make find_package work, you need to
> # add it to CMAKE_MODULE_PATH if you want to include AddLLVM, e.g., if
> # you want to use add_llvm_loadable_module.
> set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{LLVM_DIR};$ENV{Clang_
> DIR}")
> #find_package(LLVM REQUIRED CONFIG)
> find_package(Clang REQUIRED CONFIG)
> include(AddLLVM)
> add_definitions(${LLVM_DEFINITIONS})
> include_directories(${LLVM_INCLUDE_DIRS})
> include_directories(${CLANG_INCLUDE_DIRS})
> link_directories(${LLVM_LIBRARY_DIRS})
>
> message("LLVM_DEFINITIONS = ${LLVM_DEFINITIONS}")
> message("LLVM_INCLUDE_DIRS = ${LLVM_INCLUDE_DIRS}")
> message("LLVM_LIBRARY_DIRS = ${LLVM_LIBRARY_DIRS}")
> message("CLANG_INCLUDE_DIRS = ${CLANG_INCLUDE_DIRS}")
>
> On Wed, Oct 4, 2017 at 11:39 AM, Kim Gräsman via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hi all,
>>
>> In include-what-you-use, we recently had this bug report:
>> https://github.com/include-what-you-use/include-what-you-use/pull/465
>>
>> And it's symptomatic for a whole class of problems where we're
>> duplicating knowledge from the LLVM/Clang CMake systems to allow both
>> in-tree and out-of-tree IWYU development.
>>
>> (in our terminology, in-tree == cloning the include-what-you-use repo
>> into a full LLVM and Clang checkout/clone under
>> llvm/tools/clang/tools/include-what-you-use and out-of-tree == cloning
>> include-what-you-use anywhere, and giving CMake information about
>> where to find LLVM/Clang headers and libraries)
>>
>> Looking around my system, I see a lot of CMake modules in
>> /usr/lib/llvm-4.0 and /usr/share/llvm-4.0, but it's not clear to me
>> how to use them. Also, it would be nice to allow a "next-to-tree"
>> configuration instead of in-tree, where I can point IWYU at a trunk
>> checkout of LLVM and Clang and use its CMake modules.
>>
>> Is there a correct way to accomplish this?
>>
>> Thanks,
>> - Kim
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171004/606769da/attachment.html>
More information about the cfe-dev
mailing list