summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2014-02-26 11:58:01 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2014-02-26 11:58:01 +0000
commit8571df6ae59f487b087ae955952ae07edd857ee2 (patch)
treeb3a5b6f362988a23d18ce08996ec0bf3f4e56841 /cmake
parent530869f8bcd9d28acebc7836ecc022d98fcff9e2 (diff)
downloadllvm-8571df6ae59f487b087ae955952ae07edd857ee2.tar.gz
llvm-8571df6ae59f487b087ae955952ae07edd857ee2.tar.bz2
llvm-8571df6ae59f487b087ae955952ae07edd857ee2.tar.xz
[CMake] Move LLVMBUILD_LIB_DEPS stuff from add_llvm_library (and LLVm-Config) to llvm_add_library to centralize target_link_libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202260 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddLLVM.cmake43
1 files changed, 30 insertions, 13 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 543ba93e55..b07634b0b6 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -289,15 +289,40 @@ function(llvm_add_library name)
endif()
endif()
- if(ARG_STATIC)
- target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} ${ARG_LINK_LIBS})
+ # Add the explicit dependency information for this library.
+ #
+ # It would be nice to verify that we have the dependencies for this library
+ # 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})
+
+ llvm_map_components_to_libnames(llvm_libs
+ ${ARG_LINK_COMPONENTS}
+ ${LLVM_LINK_COMPONENTS}
+ )
+
+ if(CMAKE_VERSION VERSION_LESS 2.8.12)
+ # Link libs w/o keywords, assuming PUBLIC.
+ target_link_libraries(${name}
+ ${ARG_LINK_LIBS}
+ ${lib_deps}
+ ${llvm_libs}
+ )
+ elseif(ARG_STATIC)
+ target_link_libraries(${name} INTERFACE
+ ${ARG_LINK_LIBS}
+ ${lib_deps}
+ ${llvm_libs}
+ )
else()
# MODULE|SHARED
- target_link_libraries(${name} ${cmake_2_8_12_PRIVATE} ${ARG_LINK_LIBS})
+ target_link_libraries(${name} PRIVATE
+ ${ARG_LINK_LIBS}
+ ${lib_deps}
+ ${llvm_libs}
+ )
endif()
- llvm_config(${name} ${ARG_LINK_COMPONENTS} ${LLVM_LINK_COMPONENTS})
-
if(LLVM_COMMON_DEPENDS)
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
# Add dependencies also to objlibs.
@@ -328,14 +353,6 @@ macro(add_llvm_library name)
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endif()
set_target_properties(${name} PROPERTIES FOLDER "Libraries")
-
- # Add the explicit dependency information for this library.
- #
- # It would be nice to verify that we have the dependencies for this library
- # 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} ${cmake_2_8_12_INTERFACE} ${lib_deps})
endmacro(add_llvm_library name)
macro(add_llvm_loadable_module name)