[PATCH] D31696: Automatically add include-what-you-use for when building in tree

Kim Gräsman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 11:07:00 PDT 2017


kimgr added inline comments.


================
Comment at: clang/tools/CMakeLists.txt:35
+# if include-what-you-use is cloned for building in-tree, add it here.
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include-what-you-use")
+  add_clang_subdirectory(include-what-you-use)
----------------
beanz wrote:
> rnk wrote:
> > Maybe we should do `llvm_add_implicit_projects(CLANG)` here instead?
> > 
> > Or do we not want clang/tools to be a project extension point? Would IWYU build fine if we added it to llvm/projects or llvm/tools? Maybe we should just recommend that.
> Either `llvm_add_implicit_projects(CLANG)` or `add_llvm_external_project(include-what-you-use include-what-you-use)`.
> 
> The former case would make this a generic extension point, which I think is good, the later would add just this project without needing to wrap it in an `if`.
> 
> I would prefer going the implicit route because I actually have a distaste for having code living in-tree that is specifically for supporting out-of-tree code.
> Would IWYU build fine if we added it to llvm/projects or llvm/tools? Maybe we should just recommend that.

IWYU has all dependencies explicitly listed to support out-of-tree builds too, so I think it could be made to work with some include/lib path setup. But it would feel weird layering-wise, since it depends so heavily on clang.

As for `llvm_add_implicit_projects` vs `add_llvm_external_project`, I'm guessing it doesn't make a difference for IWYU's CMake system? Mild preference for `llvm_add_implicit_projects` to keep mention of `include-what-you-use` out of Clang until we can form a coherent story about upstreaming.


https://reviews.llvm.org/D31696





More information about the cfe-commits mailing list