[PATCH] D127318: [cmake] Add missing dependencies to objlib in add_llvm_executable.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 09:14:56 PDT 2022


fhahn created this revision.
fhahn added reviewers: beanz, MaskRay, abrachet, arphaman, steven_wu.
Herald added subscribers: StephenFan, mgorny.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a project: LLVM.

After f06abbb393800b0d466c88e283c06f75561c432c <https://reviews.llvm.org/rGf06abbb393800b0d466c88e283c06f75561c432c> I have been seeing build
failures due to the obj.clang target missing a dependency on
tools/clang/clang-tablegen-targets.

This appears to be due to the fact that LLVM_COMMON_DEPENDS are not added
as dependencies to the object library.

This patch uses the same logic as llvm_add_library to register
dependencies for object libraries.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127318

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -962,6 +962,11 @@
   llvm_config( ${name} ${USE_SHARED} ${LLVM_LINK_COMPONENTS} )
   if( LLVM_COMMON_DEPENDS )
     add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
+    # Add dependencies also to obj_name
+    # CMake issue 14747 --  add_dependencies() might be ignored to obj_name's user.
+    foreach(objlib ${obj_name})
+      add_dependencies(${objlib} ${LLVM_COMMON_DEPENDS})
+    endforeach()
   endif( LLVM_COMMON_DEPENDS )
 
   if(NOT ARG_IGNORE_EXTERNALIZE_DEBUGINFO)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127318.435204.patch
Type: text/x-patch
Size: 665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220608/cf594676/attachment.bin>


More information about the llvm-commits mailing list