[llvm] r201853 - Teach LLVM-Config to use logical target names (2/2)
NAKAMURA Takumi
geek4civic at gmail.com
Fri Feb 21 06:17:07 PST 2014
Author: chapuni
Date: Fri Feb 21 08:17:07 2014
New Revision: 201853
URL: http://llvm.org/viewvc/llvm-project?rev=201853&view=rev
Log:
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.
Modified:
llvm/trunk/cmake/modules/CMakeLists.txt
llvm/trunk/cmake/modules/LLVM-Config.cmake
llvm/trunk/cmake/modules/LLVMConfig.cmake.in
llvm/trunk/cmake/modules/Makefile
Modified: llvm/trunk/cmake/modules/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CMakeLists.txt?rev=201853&r1=201852&r2=201853&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/CMakeLists.txt (original)
+++ llvm/trunk/cmake/modules/CMakeLists.txt Fri Feb 21 08:17:07 2014
@@ -5,9 +5,9 @@ get_property(LLVM_EXPORTS GLOBAL PROPERT
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})")
Modified: llvm/trunk/cmake/modules/LLVM-Config.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVM-Config.cmake?rev=201853&r1=201852&r2=201853&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/LLVM-Config.cmake (original)
+++ llvm/trunk/cmake/modules/LLVM-Config.cmake Fri Feb 21 08:17:07 2014
@@ -77,8 +77,11 @@ endfunction(llvm_map_components_to_libra
# 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
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
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 )
Modified: llvm/trunk/cmake/modules/LLVMConfig.cmake.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMConfig.cmake.in?rev=201853&r1=201852&r2=201853&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/LLVMConfig.cmake.in (original)
+++ llvm/trunk/cmake/modules/LLVMConfig.cmake.in Fri Feb 21 08:17:07 2014
@@ -8,7 +8,7 @@ set(LLVM_PACKAGE_VERSION @PACKAGE_VERSIO
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@)
Modified: llvm/trunk/cmake/modules/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/Makefile?rev=201853&r1=201852&r2=201853&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/Makefile (original)
+++ llvm/trunk/cmake/modules/Makefile Fri Feb 21 08:17:07 2014
@@ -30,7 +30,7 @@ $(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMCo
-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)"'/' \
More information about the llvm-commits
mailing list