This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add CMake dependencies for Protobuf-generated files
ClosedPublic

Authored by kbobyrev on Apr 29 2020, 6:12 AM.

Details

Summary

Dependencies ensure that Protobufs are generated before all libraries
depending on the headers are built, not linked.

Diff Detail

Event Timeline

kbobyrev created this revision.Apr 29 2020, 6:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 29 2020, 6:12 AM

Otherwise sources including Index.pb.h or Index.grpc.pb.h can be compiled before the those headers are generated.

https://github.com/kirillbobyrev/indexing-tools/runs/629305684 (disregard the mess in the repo)

sammccall accepted this revision.Apr 29 2020, 6:35 AM

Haha, CMake :-(

This revision is now accepted and ready to land.Apr 29 2020, 6:35 AM
sammccall added inline comments.Apr 29 2020, 6:50 AM
clang-tools-extra/clangd/index/remote/CMakeLists.txt
25

is this equivalent to DEPENDS RemoteIndexProtos in the library?
Slightly clearer probably.

kbobyrev updated this revision to Diff 260906.Apr 29 2020, 7:05 AM
kbobyrev marked 2 inline comments as done.

Use DEPENDS instead of add_dependencies.

Haha, CMake :-(

Now that I know this it kind of makes sense (I guess it's faster to just build everything and then link when all deps are ready), just something I didn't think about :)

clang-tools-extra/clangd/index/remote/CMakeLists.txt
25

Ah, true, I had a feeling there was something like this on top of my mind, but forgot about DEPENDS :) Thanks!

This revision was automatically updated to reflect the committed changes.