summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/CMakeLists.txt2
-rw-r--r--lld/lib/Core/CMakeLists.txt2
-rw-r--r--lld/lib/ReaderWriter/CMakeLists.txt2
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake9
-rw-r--r--llvm/cmake/modules/LLVM-Config.cmake10
-rw-r--r--llvm/lib/Support/CMakeLists.txt2
6 files changed, 20 insertions, 7 deletions
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 8190203dc6a..38f10493dd2 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -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}
diff --git a/lld/lib/Core/CMakeLists.txt b/lld/lib/Core/CMakeLists.txt
index 1854b1f0f3f..5ca9c9ccdbd 100644
--- a/lld/lib/Core/CMakeLists.txt
+++ b/lld/lib/Core/CMakeLists.txt
@@ -11,7 +11,7 @@ add_lld_library(lldCore
SymbolTable.cpp
)
-target_link_libraries(lldCore
+target_link_libraries(lldCore ${cmake_2_8_12_INTERFACE}
lldNative
lldYAML
)
diff --git a/lld/lib/ReaderWriter/CMakeLists.txt b/lld/lib/ReaderWriter/CMakeLists.txt
index 4595c2d8b19..587d8594a8c 100644
--- a/lld/lib/ReaderWriter/CMakeLists.txt
+++ b/lld/lib/ReaderWriter/CMakeLists.txt
@@ -15,7 +15,7 @@ add_lld_library(lldReaderWriter
FileArchive.cpp
)
-target_link_libraries(lldReaderWriter
+target_link_libraries(lldReaderWriter ${cmake_2_8_12_INTERFACE}
lldCore
lldPasses
)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index bce3b2dd760..543ba93e552 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -289,7 +289,12 @@ function(llvm_add_library name)
endif()
endif()
- target_link_libraries(${name} ${ARG_LINK_LIBS})
+ if(ARG_STATIC)
+ target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} ${ARG_LINK_LIBS})
+ else()
+ # MODULE|SHARED
+ target_link_libraries(${name} ${cmake_2_8_12_PRIVATE} ${ARG_LINK_LIBS})
+ endif()
llvm_config(${name} ${ARG_LINK_COMPONENTS} ${LLVM_LINK_COMPONENTS})
@@ -330,7 +335,7 @@ macro(add_llvm_library name)
# name, but using get_property(... SET) doesn't suffice to determine if a
# property has been set to an empty value.
get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name})
- target_link_libraries(${name} ${lib_deps})
+ target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} ${lib_deps})
endmacro(add_llvm_library name)
macro(add_llvm_loadable_module name)
diff --git a/llvm/cmake/modules/LLVM-Config.cmake b/llvm/cmake/modules/LLVM-Config.cmake
index 451fc56c6bf..2783af807a1 100644
--- a/llvm/cmake/modules/LLVM-Config.cmake
+++ b/llvm/cmake/modules/LLVM-Config.cmake
@@ -39,7 +39,15 @@ function(explicit_llvm_config executable)
set( link_components ${ARGN} )
llvm_map_components_to_libnames(LIBRARIES ${link_components})
- target_link_libraries(${executable} ${LIBRARIES})
+ get_target_property(t ${executable} TYPE)
+ if("${t}" STREQUAL "STATIC_LIBRARY")
+ target_link_libraries(${executable} ${cmake_2_8_12_INTERFACE} ${LIBRARIES})
+ elseif("${t}" STREQUAL "SHARED_LIBRARY" OR "${t}" STREQUAL "MODULE_LIBRARY")
+ target_link_libraries(${executable} ${cmake_2_8_12_PRIVATE} ${LIBRARIES})
+ else()
+ # Use plain form for legacy user.
+ target_link_libraries(${executable} ${LIBRARIES})
+ endif()
endfunction(explicit_llvm_config)
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 0b5f623d3a9..a32d238d287 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -142,5 +142,5 @@ if( NOT MSVC )
endif()
endif( MINGW )
endif( NOT MSVC )
-target_link_libraries(LLVMSupport ${system_libs})
+target_link_libraries(LLVMSupport ${cmake_2_8_12_INTERFACE} ${system_libs})
set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${system_libs}")
OpenPOWER on IntegriCloud