summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2014-02-21 14:17:07 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2014-02-21 14:17:07 +0000
commit6eeedf33d596dee084b12cbcfc109d3c2be854f4 (patch)
tree4236cc58cdd33e6c457e73f67e7b3333115b42e6 /cmake
parent83782f2571d25ec035a353acce17c8b86c5cb4ad (diff)
downloadllvm-6eeedf33d596dee084b12cbcfc109d3c2be854f4.tar.gz
llvm-6eeedf33d596dee084b12cbcfc109d3c2be854f4.tar.bz2
llvm-6eeedf33d596dee084b12cbcfc109d3c2be854f4.tar.xz
Teach LLVM-Config to use logical target names (2/2)
The module still needs to collect the list of all available libraries in order to satisfy the 'all' component. Provide this in the package configuration file, 'LLVMConfig.cmake', as a LLVM_AVAILABLE_LIBS variable. (A variable is scoped better than a global property.) Since this won't be set for our own build, fall back to looking up the LLVM_LIBS property to get the value when it is not set. Contributed by Brad King. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/CMakeLists.txt4
-rw-r--r--cmake/modules/LLVM-Config.cmake11
-rw-r--r--cmake/modules/LLVMConfig.cmake.in2
-rw-r--r--cmake/modules/Makefile2
4 files changed, 11 insertions, 8 deletions
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 8ab5ca27f5..08aeeb9a92 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -5,9 +5,9 @@ get_property(LLVM_EXPORTS GLOBAL PROPERTY LLVM_EXPORTS)
export(TARGETS ${LLVM_EXPORTS}
FILE ${llvm_cmake_builddir}/LLVMExports.cmake)
-get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
+get_property(LLVM_AVAILABLE_LIBS GLOBAL PROPERTY LLVM_LIBS)
-foreach(lib ${llvm_libs})
+foreach(lib ${LLVM_AVAILABLE_LIBS})
get_property(llvm_lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib})
set(all_llvm_lib_deps
"${all_llvm_lib_deps}\nset_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib} ${llvm_lib_deps})")
diff --git a/cmake/modules/LLVM-Config.cmake b/cmake/modules/LLVM-Config.cmake
index 62470d0dde..af720fcb21 100644
--- a/cmake/modules/LLVM-Config.cmake
+++ b/cmake/modules/LLVM-Config.cmake
@@ -77,8 +77,11 @@ endfunction(llvm_map_components_to_libraries)
# Map LINK_COMPONENTS to actual libnames.
function(llvm_map_components_to_libnames out_libs)
set( link_components ${ARGN} )
- get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
- string(TOUPPER "${llvm_libs}" capitalized_libs)
+ if(NOT LLVM_AVAILABLE_LIBS)
+ # Inside LLVM itself available libs are in a global property.
+ get_property(LLVM_AVAILABLE_LIBS GLOBAL PROPERTY LLVM_LIBS)
+ endif()
+ string(TOUPPER "${LLVM_AVAILABLE_LIBS}" capitalized_libs)
# Expand some keywords:
list(FIND LLVM_TARGETS_TO_BUILD "${LLVM_NATIVE_ARCH}" have_native_backend)
@@ -134,7 +137,7 @@ function(llvm_map_components_to_libnames out_libs)
elseif( c STREQUAL "engine" )
# already processed
elseif( c STREQUAL "all" )
- list(APPEND expanded_components ${llvm_libs})
+ list(APPEND expanded_components ${LLVM_AVAILABLE_LIBS})
else( NOT idx LESS 0 )
# Canonize the component name:
string(TOUPPER "${c}" capitalized)
@@ -146,7 +149,7 @@ function(llvm_map_components_to_libnames out_libs)
message(FATAL_ERROR "Library `${c}' not found in list of llvm libraries.")
endif()
else( lib_idx LESS 0 )
- list(GET llvm_libs ${lib_idx} canonical_lib)
+ list(GET LLVM_AVAILABLE_LIBS ${lib_idx} canonical_lib)
list(APPEND expanded_components ${canonical_lib})
endif( lib_idx LESS 0 )
endif( NOT idx LESS 0 )
diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
index c1b6450ad6..11857a5384 100644
--- a/cmake/modules/LLVMConfig.cmake.in
+++ b/cmake/modules/LLVMConfig.cmake.in
@@ -8,7 +8,7 @@ set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@)
set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@)
-set_property( GLOBAL PROPERTY LLVM_LIBS "@llvm_libs@")
+set(LLVM_AVAILABLE_LIBS @LLVM_AVAILABLE_LIBS@)
set(LLVM_ALL_TARGETS @LLVM_ALL_TARGETS@)
diff --git a/cmake/modules/Makefile b/cmake/modules/Makefile
index 055e935860..894067d6f5 100644
--- a/cmake/modules/Makefile
+++ b/cmake/modules/Makefile
@@ -30,7 +30,7 @@ $(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMConfig.cmake.in $(LLVMBuildCMakeFrag)
-e 's/@LLVM_VERSION_MINOR@/'"$(LLVM_VERSION_MINOR)"'/' \
-e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \
-e 's/@LLVM_COMMON_DEPENDS@//' \
- -e 's/"@llvm_libs@"/'"$(subst -l,,$(LLVMConfigLibs))"'/' \
+ -e 's/@LLVM_AVAILABLE_LIBS@/'"$(subst -l,,$(LLVMConfigLibs))"'/' \
-e 's/@LLVM_ALL_TARGETS@/'"$(ALL_TARGETS)"'/' \
-e 's/@LLVM_TARGETS_TO_BUILD@/'"$(TARGETS_TO_BUILD)"'/' \
-e 's/@LLVM_TARGETS_WITH_JIT@/'"$(TARGETS_WITH_JIT)"'/' \