From f51fbcbb3683e1810d19fee49e2897501d4d67f4 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 14 Jul 2014 12:26:15 +0000 Subject: [PATCH] [CMake][Win32.DLL] Let llvm_add_library(SHARED) link dependent libraries as PRIVATE. For example, c-index-test.exe requires just libclang.dll (its import library). When libraries in libclang were not PRIVATE but PUBLIC, c-index-test required libraries transitive by libclang. Note, on mingw with BUILD_SHARED_LIBS, library dependencies would become more strict. In principle, required libraries should be "required in its source file". This will help to detect missing dependencies. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212934 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/modules/AddLLVM.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 85149abf5e3..0276bf6ffe4 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -333,6 +333,13 @@ function(llvm_add_library name) ${lib_deps} ${llvm_libs} ) + elseif((CYGWIN OR WIN32) AND ARG_SHARED) + # Win32's import library may be unaware of its dependent libs. + target_link_libraries(${name} PRIVATE + ${ARG_LINK_LIBS} + ${lib_deps} + ${llvm_libs} + ) elseif(ARG_SHARED AND BUILD_SHARED_LIBS) # FIXME: It may be PRIVATE since SO knows its dependent libs. target_link_libraries(${name} PUBLIC -- 2.34.1