[llvm] r212934 - [CMake][Win32.DLL] Let llvm_add_library(SHARED) link dependent libraries as PRIVATE.
NAKAMURA Takumi
geek4civic at gmail.com
Mon Jul 14 05:26:16 PDT 2014
Author: chapuni
Date: Mon Jul 14 07:26:15 2014
New Revision: 212934
URL: http://llvm.org/viewvc/llvm-project?rev=212934&view=rev
Log:
[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.
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=212934&r1=212933&r2=212934&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Mon Jul 14 07:26:15 2014
@@ -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
More information about the llvm-commits
mailing list