[PATCH] D67321: Respect CLANG_LINK_CLANG_DYLIB=ON in libclang and c-index-test
Aaron Puchert via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 28 15:34:48 PDT 2019
aaronpuchert updated this revision to Diff 222303.
aaronpuchert added a comment.
Fix typo.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67321/new/
https://reviews.llvm.org/D67321
Files:
clang/cmake/modules/AddClang.cmake
clang/tools/c-index-test/CMakeLists.txt
clang/tools/libclang/CMakeLists.txt
Index: clang/tools/libclang/CMakeLists.txt
===================================================================
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -34,7 +34,7 @@
../../include/clang-c/Index.h
)
-set(LIBS
+set(CLANG_LIB_DEPS
clangAST
clangBasic
clangDriver
@@ -44,11 +44,10 @@
clangSema
clangSerialization
clangTooling
- LLVMSupport
)
if (CLANG_ENABLE_ARCMT)
- list(APPEND LIBS clangARCMigrate)
+ list(APPEND CLANG_LIB_DEPS clangARCMigrate)
endif ()
if (TARGET clangTidyPlugin)
@@ -113,6 +112,11 @@
Support
)
+clang_target_link_libraries(libclang
+ PRIVATE
+ ${CLANG_LIB_DEPS}
+ )
+
if(ENABLE_SHARED)
if(WIN32)
set_target_properties(libclang
Index: clang/tools/c-index-test/CMakeLists.txt
===================================================================
--- clang/tools/c-index-test/CMakeLists.txt
+++ clang/tools/c-index-test/CMakeLists.txt
@@ -25,6 +25,9 @@
target_link_libraries(c-index-test
PRIVATE
libclang
+ )
+ clang_target_link_libraries(c-index-test
+ PRIVATE
clangAST
clangBasic
clangCodeGen
Index: clang/cmake/modules/AddClang.cmake
===================================================================
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -173,11 +173,25 @@
llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
endmacro()
+# Link with a Clang component library, or clang-cpp if CLANG_LINK_CLANG_DYLIB
+# is set. If target is a static library, PUBLIC and PRIVATE dependencies are
+# treated as INTERFACE dependencies, so this can replace LINK_LIBS.
function(clang_target_link_libraries target type)
+ get_target_property(TARGET_TYPE ${target} TYPE)
+ if(${TARGET_TYPE} EQUAL "STATIC_LIBRARY")
+ set(type INTERFACE)
+ endif()
if (CLANG_LINK_CLANG_DYLIB)
target_link_libraries(${target} ${type} clang-cpp)
else()
target_link_libraries(${target} ${type} ${ARGN})
endif()
+ if (TARGET "${target}_static")
+ if (CLANG_LINK_CLANG_DYLIB)
+ target_link_libraries("${target}_static" INTERFACE clang-cpp)
+ else()
+ target_link_libraries("${target}_static" INTERFACE ${ARGN})
+ endif()
+ endif()
endfunction()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67321.222303.patch
Type: text/x-patch
Size: 2249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190928/bbaa5986/attachment.bin>
More information about the cfe-commits
mailing list