llvm.org GIT mirror llvm / 6eeedf3
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 NAKAMURA Takumi 5 years ago
4 changed file(s) with 11 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
44 export(TARGETS ${LLVM_EXPORTS}
55 FILE ${llvm_cmake_builddir}/LLVMExports.cmake)
66
7 get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
7 get_property(LLVM_AVAILABLE_LIBS GLOBAL PROPERTY LLVM_LIBS)
88
9 foreach(lib ${llvm_libs})
9 foreach(lib ${LLVM_AVAILABLE_LIBS})
1010 get_property(llvm_lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib})
1111 set(all_llvm_lib_deps
1212 "${all_llvm_lib_deps}\nset_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib} ${llvm_lib_deps})")
7676 # Map LINK_COMPONENTS to actual libnames.
7777 function(llvm_map_components_to_libnames out_libs)
7878 set( link_components ${ARGN} )
79 get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
80 string(TOUPPER "${llvm_libs}" capitalized_libs)
79 if(NOT LLVM_AVAILABLE_LIBS)
80 # Inside LLVM itself available libs are in a global property.
81 get_property(LLVM_AVAILABLE_LIBS GLOBAL PROPERTY LLVM_LIBS)
82 endif()
83 string(TOUPPER "${LLVM_AVAILABLE_LIBS}" capitalized_libs)
8184
8285 # Expand some keywords:
8386 list(FIND LLVM_TARGETS_TO_BUILD "${LLVM_NATIVE_ARCH}" have_native_backend)
133136 elseif( c STREQUAL "engine" )
134137 # already processed
135138 elseif( c STREQUAL "all" )
136 list(APPEND expanded_components ${llvm_libs})
139 list(APPEND expanded_components ${LLVM_AVAILABLE_LIBS})
137140 else( NOT idx LESS 0 )
138141 # Canonize the component name:
139142 string(TOUPPER "${c}" capitalized)
145148 message(FATAL_ERROR "Library `${c}' not found in list of llvm libraries.")
146149 endif()
147150 else( lib_idx LESS 0 )
148 list(GET llvm_libs ${lib_idx} canonical_lib)
151 list(GET LLVM_AVAILABLE_LIBS ${lib_idx} canonical_lib)
149152 list(APPEND expanded_components ${canonical_lib})
150153 endif( lib_idx LESS 0 )
151154 endif( NOT idx LESS 0 )
77
88 set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@)
99
10 set_property( GLOBAL PROPERTY LLVM_LIBS "@llvm_libs@")
10 set(LLVM_AVAILABLE_LIBS @LLVM_AVAILABLE_LIBS@)
1111
1212 set(LLVM_ALL_TARGETS @LLVM_ALL_TARGETS@)
1313
2929 -e 's/@LLVM_VERSION_MINOR@/'"$(LLVM_VERSION_MINOR)"'/' \
3030 -e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \
3131 -e 's/@LLVM_COMMON_DEPENDS@//' \
32 -e 's/"@llvm_libs@"/'"$(subst -l,,$(LLVMConfigLibs))"'/' \
32 -e 's/@LLVM_AVAILABLE_LIBS@/'"$(subst -l,,$(LLVMConfigLibs))"'/' \
3333 -e 's/@LLVM_ALL_TARGETS@/'"$(ALL_TARGETS)"'/' \
3434 -e 's/@LLVM_TARGETS_TO_BUILD@/'"$(TARGETS_TO_BUILD)"'/' \
3535 -e 's/@LLVM_TARGETS_WITH_JIT@/'"$(TARGETS_WITH_JIT)"'/' \