[clang-tools-extra] 2ef2841 - [clangd] Fix proto deps, for real this time.

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 27 01:15:51 PDT 2020


Author: Sam McCall
Date: 2020-10-27T09:15:42+01:00
New Revision: 2ef2841c0d0b49a76ea9026f37207a473d7d1332

URL: https://github.com/llvm/llvm-project/commit/2ef2841c0d0b49a76ea9026f37207a473d7d1332
DIFF: https://github.com/llvm/llvm-project/commit/2ef2841c0d0b49a76ea9026f37207a473d7d1332.diff

LOG: [clangd] Fix proto deps, for real this time.

This is ugly (layering violation) but we can clean it up once we know it
works in CI.

Added: 
    

Modified: 
    clang-tools-extra/clangd/index/remote/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/index/remote/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
index 971af205f45d..554288df0bcb 100644
--- a/clang-tools-extra/clangd/index/remote/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
@@ -1,12 +1,13 @@
 if (CLANGD_ENABLE_REMOTE)
   generate_protos(RemoteIndexServiceProto "Service.proto" GRPC)
   generate_protos(RemoteIndexProto "Index.proto")
-  target_link_libraries(RemoteIndexServiceProto
-
-    PUBLIC
-    RemoteIndexProto
-    )
-  add_dependencies(RemoteIndexServiceProto RemoteIndexProto)
+  # Ensure dependency headers are generated before dependent protos are built.
+  # FIXME: this should be encapsulated in generate_protos.
+  # FIXME: CMake docs say OBJECT_DEPENDS isn't needed, but I can't get the
+  #        recommended add_dependencies() approach to work.
+  set_source_files_properties(
+    ${CMAKE_CURRENT_BINARY_DIR}/Service.pb.cc
+    PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Index.pb.h)
   include_directories(${CMAKE_CURRENT_BINARY_DIR})
   include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../)
 


        


More information about the cfe-commits mailing list