Make my attempt to build up global deps variables actually utilize
authorChandler Carruth <chandlerc@gmail.com>
Fri, 29 Jul 2011 23:52:01 +0000 (23:52 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 29 Jul 2011 23:52:01 +0000 (23:52 +0000)
globally scoped constructs. Also, round-trip these dependencies through
the LLVMConfig.cmake.in file thata is used by CMake-based clients of
"installed" (or built) LLVM trees.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136543 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddLLVM.cmake
cmake/modules/CMakeLists.txt
cmake/modules/LLVM-Config.cmake
cmake/modules/LLVMConfig.cmake.in

index cf9ea72107d5c9beaad4b3f57ff61dcad84c174a..1ede0f0a2b2fbb9b3dc013c20c0ea54db8415c8a 100755 (executable)
@@ -37,7 +37,7 @@ endmacro(add_llvm_library name)
 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})
index 298da95d1e151bac0fa1e1072ec1af815472537c..09979d0f52b5179f863806af100c8699f952f547 100644 (file)
@@ -3,6 +3,12 @@ set(LLVM_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
 
 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
index d6b31245b066bf679d86a9cb7e1d8830a3f2c2ab..b5f262a24da83fc806d9f56e7044cc3c3a8d72f3 100755 (executable)
@@ -135,14 +135,14 @@ function(explicit_map_components_to_libraries out_libs)
       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)
@@ -152,7 +152,8 @@ function(explicit_map_components_to_libraries out_libs)
   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)
index 5a048b714b57a0d3361f6f03f5bfbf90b348fd43..6b202b2e7e8766e0e67a23e9f1845a2e18f2d795 100644 (file)
@@ -12,6 +12,8 @@ set(LLVM_TARGETS_TO_BUILD @LLVM_TARGETS_TO_BUILD@)
 
 set(LLVM_TARGETS_WITH_JIT @LLVM_TARGETS_WITH_JIT@)
 
+@all_llvm_lib_deps@
+
 set(TARGET_TRIPLE "@TARGET_TRIPLE@")
 
 set(LLVM_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@)