[Lldb-commits] [PATCH] D68071: cmake: Link lldb libraries and tools with libclang-cpp.so when CLANG_LINK_LLVM_DYLIB=ON
Tom Stellard via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 25 21:39:32 PDT 2019
tstellar created this revision.
tstellar added reviewers: beanz, smeenai, clayborg, zturner.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68071
Files:
lldb/cmake/modules/AddLLDB.cmake
Index: lldb/cmake/modules/AddLLDB.cmake
===================================================================
--- lldb/cmake/modules/AddLLDB.cmake
+++ lldb/cmake/modules/AddLLDB.cmake
@@ -27,6 +27,22 @@
endif()
endfunction(lldb_tablegen)
+# Filter out clang libraries and add clang_shared when CLANG_LINK_CLANG_DYLIB=ON
+function(lldb_filter_link_libs link_libs)
+
+ set(link_libs_list ${${link_libs}})
+ list(LENGTH link_libs_list lib_count)
+ if (CLANG_LINK_CLANG_DYLIB AND lib_count GREATER 0)
+ list(FILTER link_libs_list EXCLUDE REGEX "^clang")
+ list(LENGTH link_libs_list filtered_lib_count)
+ if (filtered_lib_count LESS lib_count)
+ list(APPEND link_libs_list clang-cpp)
+ endif()
+ endif()
+ set(${link_libs} ${link_libs_list} PARENT_SCOPE)
+
+endfunction(lldb_filter_link_libs)
+
function(add_lldb_library name)
include_directories(BEFORE
${CMAKE_CURRENT_BINARY_DIR}
@@ -85,6 +101,8 @@
set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
endif()
+ lldb_filter_link_libs(PARAM_LINK_LIBS)
+
llvm_add_library(${name} ${libkind} ${srcs}
LINK_LIBS ${PARAM_LINK_LIBS}
DEPENDS ${PARAM_DEPENDS}
@@ -155,6 +173,8 @@
${ARG_UNPARSED_ARGUMENTS}
)
+ lldb_filter_link_libs(ARG_LINK_LIBS)
+
target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68071.221885.patch
Type: text/x-patch
Size: 1403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190926/beed6b97/attachment.bin>
More information about the lldb-commits
mailing list