[PATCH] D49193: [CMake] Export the LLVM_LINK_LLVM_DYLIB setting

Philip Pfaffe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 08:56:07 PDT 2018


philip.pfaffe created this revision.
philip.pfaffe added reviewers: mgorny, beanz, labath.
Herald added a subscriber: bollu.

When building out-of-tree tools, there are several macros available to
automate linking against llvm. An examples is `add_llvm_executable`, or
the clang variant of this.

These macros use the LLVM_LINK_LLVM_DYLIB option to decide whether to
link against libraries defined by setting LLVM_LINK_COMPONENTS or to
link against libLLVM instead. Currently this is problematic in
out-of-tree targets, because they cannot identify whether this option is
required or even available. If the option was enabled in LLVM's own
build, the clang libraries are built against libLLVM, so a client
linking against those must link against it too. On the other hand the
client can't just always link against it, because it might not be
available.

This is related to https://reviews.llvm.org/D44391, but that change assumed the client knew
whether they wanted the dylib or not.


https://reviews.llvm.org/D49193

Files:
  llvm/cmake/modules/LLVMConfig.cmake.in


Index: llvm/cmake/modules/LLVMConfig.cmake.in
===================================================================
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -13,6 +13,8 @@
 
 set(LLVM_AVAILABLE_LIBS @LLVM_AVAILABLE_LIBS@)
 
+set(LLVM_LINK_LLVM_DYLIB @LLVM_LINK_LLVM_DYLIB@)
+
 set(LLVM_DYLIB_COMPONENTS @LLVM_DYLIB_COMPONENTS@)
 
 set(LLVM_ALL_TARGETS @LLVM_ALL_TARGETS@)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49193.155018.patch
Type: text/x-patch
Size: 418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180711/52899b66/attachment.bin>


More information about the llvm-commits mailing list