[PATCH] D91859: [clangd] Fix shared-lib builds

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 21 01:39:25 PST 2020


kadircet added a subscriber: nridge.
kadircet added a comment.

> I don't think that's how CMake works, the whole CMakeLists tree is parsed before anything is compiled, so it shouldn't race like that.

That was also my mental model, but it looks like `include_directories` statement within the `FindGRPC` submodule only affects targets created afterwards (lexicographically). Even though cmake docs say that it should affect everything within that cmakelists file (https://cmake.org/cmake/help/latest/command/include_directories.html).

I've tried to migrate into target_include_directories instead(i.e. only introduce the include header to targets generated via `generate_protos` and propagate into their dependents), and it works great with targets introduced via `add_clang_executable` or `add_unittest`, but for some reason I could not figure out; propagation doesn't work for targets introduced via `add_clang_library` :(.

And indeed my compile commands also didn't contain the necessary `-isystem`, but I had an acceptable version of protobuf installed in /usr/include even though i tried really hard to delete all the remaining packages, so it was working on my machine :/

Hopefully it should be good now. It is quite nice that @nridge has also noticed this while we are working on a fix, so I hope he can try this patch on his setup as well :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91859/new/

https://reviews.llvm.org/D91859



More information about the cfe-commits mailing list