[PATCH] D49843: [CMake] Followup for r337366: Only export LLVM_LINK_LLVM_DYLIB it it's set to ON

Philip Pfaffe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 26 04:05:34 PDT 2018


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

As it was, always exporting LLVM_LINK_LLVM_DYLIB caused out-of-tree
clients to lose the ability to link against the dylib, even if in-tree tools did
not. By only exporting the setting if it is enabled, out-of-tree clients get the
correct default, but may still choose if they can.


https://reviews.llvm.org/D49843

Files:
  llvm/cmake/modules/CMakeLists.txt
  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,7 +13,7 @@
 
 set(LLVM_AVAILABLE_LIBS @LLVM_AVAILABLE_LIBS@)
 
-set(LLVM_LINK_LLVM_DYLIB @LLVM_LINK_LLVM_DYLIB@)
+ at LLVM_CONFIG_LINK_LLVM_DYLIB@
 
 set(LLVM_DYLIB_COMPONENTS @LLVM_DYLIB_COMPONENTS@)
 
Index: llvm/cmake/modules/CMakeLists.txt
===================================================================
--- llvm/cmake/modules/CMakeLists.txt
+++ llvm/cmake/modules/CMakeLists.txt
@@ -47,6 +47,12 @@
 set(LLVM_CONFIG_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
 set(LLVM_CONFIG_BINARY_DIR "${LLVM_BINARY_DIR}")
 set(LLVM_CONFIG_TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}")
+
+if (LLVM_LINK_LLVM_DYLIB)
+  set(LLVM_CONFIG_LINK_LLVM_DYLIB
+      "set(LLVM_LINK_LLVM_DYLIB ${LLVM_LINK_LLVM_DYLIB})")
+endif()
+
 # We need to use the full path to the LLVM Exports file to make sure we get the
 # one from the build tree. This is due to our cmake files being split between
 # this source dir and the binary dir in the build tree configuration and the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49843.157455.patch
Type: text/x-patch
Size: 1154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180726/63effd73/attachment.bin>


More information about the llvm-commits mailing list