[PATCH] D80103: [cmake][NFC] Check for incorrect usage of LLVM components in LINK_LIBS

Stephen Neuendorffer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 19 14:55:16 PDT 2020


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0368c1de9cda: [MLIR][cmake][NFC] Check for incorrect usage of LLVM components in LINK_LIBS (authored by stephenneuendorffer).

Changed prior to commit:
  https://reviews.llvm.org/D80103?vs=264727&id=265055#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80103

Files:
  mlir/cmake/modules/AddMLIR.cmake


Index: mlir/cmake/modules/AddMLIR.cmake
===================================================================
--- mlir/cmake/modules/AddMLIR.cmake
+++ mlir/cmake/modules/AddMLIR.cmake
@@ -108,6 +108,18 @@
 
   # MLIR libraries uniformly depend on LLVMSupport.  Just specify it once here.
   list(APPEND ARG_LINK_COMPONENTS Support)
+
+  # LINK_COMPONENTS is necessary to allow libLLVM.so to be properly
+  # substituted for individual library dependencies if LLVM_LINK_LLVM_DYLIB
+  # Perhaps this should be in llvm_add_library instead?  However, it fails
+  # on libclang-cpp.so
+  get_property(llvm_component_libs GLOBAL PROPERTY LLVM_COMPONENT_LIBS)
+  foreach(lib ${ARG_LINK_LIBS})
+    if(${lib} IN_LIST llvm_component_libs)
+      message(SEND_ERROR "${name} specifies LINK_LIBS ${lib}, but LINK_LIBS cannot be used for LLVM libraries.  Please use LINK_COMPONENTS instead.")
+    endif()
+  endforeach()
+
   list(APPEND ARG_DEPENDS mlir-generic-headers)
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs} DEPENDS ${ARG_DEPENDS} LINK_COMPONENTS ${ARG_LINK_COMPONENTS} LINK_LIBS ${ARG_LINK_LIBS})
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80103.265055.patch
Type: text/x-patch
Size: 1124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200519/b0237920/attachment-0001.bin>


More information about the llvm-commits mailing list