llvm.org GIT mirror llvm / 07f95b3
[CMake] Use target_link_libraries(INTERFACE|PRIVATE) on CMake-2.8.12 to increase opportunity for parallel build. 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/llvm/trunk@202241 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 6 years ago
3 changed file(s) with 17 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
288288 endif()
289289 endif()
290290
291 target_link_libraries(${name} ${ARG_LINK_LIBS})
291 if(ARG_STATIC)
292 target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} ${ARG_LINK_LIBS})
293 else()
294 # MODULE|SHARED
295 target_link_libraries(${name} ${cmake_2_8_12_PRIVATE} ${ARG_LINK_LIBS})
296 endif()
292297
293298 llvm_config(${name} ${ARG_LINK_COMPONENTS} ${LLVM_LINK_COMPONENTS})
294299
329334 # name, but using get_property(... SET) doesn't suffice to determine if a
330335 # property has been set to an empty value.
331336 get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name})
332 target_link_libraries(${name} ${lib_deps})
337 target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} ${lib_deps})
333338 endmacro(add_llvm_library name)
334339
335340 macro(add_llvm_loadable_module name)
3838 set( link_components ${ARGN} )
3939
4040 llvm_map_components_to_libnames(LIBRARIES ${link_components})
41 target_link_libraries(${executable} ${LIBRARIES})
41 get_target_property(t ${executable} TYPE)
42 if("${t}" STREQUAL "STATIC_LIBRARY")
43 target_link_libraries(${executable} ${cmake_2_8_12_INTERFACE} ${LIBRARIES})
44 elseif("${t}" STREQUAL "SHARED_LIBRARY" OR "${t}" STREQUAL "MODULE_LIBRARY")
45 target_link_libraries(${executable} ${cmake_2_8_12_PRIVATE} ${LIBRARIES})
46 else()
47 # Use plain form for legacy user.
48 target_link_libraries(${executable} ${LIBRARIES})
49 endif()
4250 endfunction(explicit_llvm_config)
4351
4452
141141 endif()
142142 endif( MINGW )
143143 endif( NOT MSVC )
144 target_link_libraries(LLVMSupport ${system_libs})
144 target_link_libraries(LLVMSupport ${cmake_2_8_12_INTERFACE} ${system_libs})
145145 set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${system_libs}")