]> granicus.if.org Git - clang/commitdiff
[CMake] Use target_link_libraries(INTERFACE|PRIVATE) on CMake-2.8.12 to increase...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 26 Feb 2014 06:53:16 +0000 (06:53 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 26 Feb 2014 06:53:16 +0000 (06:53 +0000)
target_link_libraries(INTERFACE) doesn't bring inter-target dependencies in add_library,
although final targets have dependencies to whole dependent libraries.
It makes most libraries can be built in parallel.

target_link_libraries(PRIVATE) is used to shaared library.
Each dependent library is linked to the target.so, and its user will not see its grandchildren.
For example,

  - libclang.so has sufficient libclang*.a(s).
  - c-index-test requires just only libclang.so.

FIXME: lld is tweaked minimally. Adding INTERFACE in each library would be better thing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202241 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt

index 8190203dc6aee73b7f3457593ccb5aab53557042..38f10493dd26fbf31bed65a127c674252a85f79b 100644 (file)
@@ -326,7 +326,7 @@ macro(add_clang_library name)
   llvm_add_library(${name} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
 
   if(TARGET ${name})
-    target_link_libraries( ${name} ${LLVM_COMMON_LIBS} )
+    target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} ${LLVM_COMMON_LIBS})
 
     if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libclang")
       install(TARGETS ${name}