Skip to content

Commit 5fed24a

Browse files
committed
[CMake] Followup for r337366: Only export LLVM_LINK_LLVM_DYLIB if it's set to ON
Summary: 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. Reviewers: mgorny, beanz, labath, bogner, chandlerc Reviewed By: bogner, chandlerc Subscribers: bollu, llvm-commits Differential Revision: https://reviews.llvm.org/D49843 llvm-svn: 338119
1 parent 78e4b4d commit 5fed24a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

llvm/cmake/modules/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ set(LLVM_CONFIG_LIBRARY_DIRS
4747
set(LLVM_CONFIG_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
4848
set(LLVM_CONFIG_BINARY_DIR "${LLVM_BINARY_DIR}")
4949
set(LLVM_CONFIG_TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}")
50+
51+
if (LLVM_LINK_LLVM_DYLIB)
52+
set(LLVM_CONFIG_LINK_LLVM_DYLIB
53+
"set(LLVM_LINK_LLVM_DYLIB ${LLVM_LINK_LLVM_DYLIB})")
54+
endif()
55+
5056
# We need to use the full path to the LLVM Exports file to make sure we get the
5157
# one from the build tree. This is due to our cmake files being split between
5258
# this source dir and the binary dir in the build tree configuration and the

llvm/cmake/modules/LLVMConfig.cmake.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@)
1313

1414
set(LLVM_AVAILABLE_LIBS @LLVM_AVAILABLE_LIBS@)
1515

16-
set(LLVM_LINK_LLVM_DYLIB @LLVM_LINK_LLVM_DYLIB@)
16+
@LLVM_CONFIG_LINK_LLVM_DYLIB@
1717

1818
set(LLVM_DYLIB_COMPONENTS @LLVM_DYLIB_COMPONENTS@)
1919

0 commit comments

Comments
 (0)