macro(add_llvm_library_dependencies name)
# Save the dependencies of the LLVM library in a variable so that we can
# query it when resolve llvm-config-style component -> library mappings.
- set(LLVM_LIB_DEPS_${name} ${ARGN})
+ set_property(GLOBAL PROPERTY LLVM_LIB_DEPS_${name} ${ARGN})
# Then add the actual dependencies to the library target.
target_link_libraries(${name} ${ARGN})
get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
+foreach(lib ${llvm_libs})
+ get_property(llvm_lib_deps GLOBAL PROPERTY LLVM_LIB_DEPS_${lib})
+ set(all_llvm_lib_deps
+ "${all_llvm_lib_deps}\nset_property(GLOBAL PROPERTY LLVM_LIB_DEPS_${lib} ${llvm_lib_deps})")
+endforeach(lib)
+
configure_file(
LLVMConfig.cmake.in
${llvm_cmake_builddir}/LLVMConfig.cmake
string(TOUPPER "${c}" capitalized)
list(FIND capitalized_libs LLVM${capitalized} lib_idx)
if( lib_idx LESS 0 )
- # The component is unknown. Maybe is an omitted target?
- is_llvm_target_library(${c} iltl_result)
- if( NOT iltl_result )
- message(FATAL_ERROR "Library `${c}' not found in list of llvm libraries.")
- endif()
+ # The component is unknown. Maybe is an omitted target?
+ is_llvm_target_library(${c} iltl_result)
+ if( NOT iltl_result )
+ 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(APPEND expanded_components ${canonical_lib})
+ list(GET llvm_libs ${lib_idx} canonical_lib)
+ list(APPEND expanded_components ${canonical_lib})
endif( lib_idx LESS 0 )
endif( NOT idx LESS 0 )
endforeach(c)
set(processed)
while( cursor LESS lst_size )
list(GET expanded_components ${cursor} lib)
- list(APPEND expanded_components ${LLVM_LIB_DEPS_${lib}})
+ get_property(lib_deps GLOBAL PROPERTY LLVM_LIB_DEPS_${lib})
+ list(APPEND expanded_components ${lib_deps})
# Remove duplicates at the front:
list(REVERSE expanded_components)
list(REMOVE_DUPLICATES expanded_components)