aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-config
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-09-13 23:59:48 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-09-13 23:59:48 +0000
commit3a210e2d302758101ac06946e86027b327c7d0f3 (patch)
treee12390ee573b3d34a2b48b5aadfcb52d2b46296a /tools/llvm-config
parentbd916c54b7989ddbab373c61eb1ed2556ca44d27 (diff)
Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."
This reverts commit r113632 Conflicts: cmake/modules/AddLLVM.cmake git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113819 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-config')
-rw-r--r--tools/llvm-config/CMakeLists.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
index 8887a64a63..663cae5ed2 100644
--- a/tools/llvm-config/CMakeLists.txt
+++ b/tools/llvm-config/CMakeLists.txt
@@ -110,6 +110,10 @@ add_custom_target(llvm-config.target ALL
add_dependencies(llvm-config.target ${llvm_lib_targets})
+# Make sure that llvm-config builds before the llvm tools, so we have
+# LibDeps.txt and can use it for updating the hard-coded library
+# dependencies on cmake/modules/LLVMLibDeps.cmake when the tools'
+# build fail due to outdated dependencies:
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} llvm-config.target)
install(FILES ${LLVM_CONFIG}
@@ -118,4 +122,25 @@ install(FILES ${LLVM_CONFIG}
DESTINATION bin)
+# Regeneration of library dependencies.
+
+# See the comments at the end of cmake/modules/LLVMConfig.cmake for
+# notes and guidelines.
+
+set(LLVMLibDeps ${LLVM_MAIN_SRC_DIR}/cmake/modules/LLVMLibDeps.cmake)
+set(LLVMLibDeps_TMP ${CMAKE_CURRENT_BINARY_DIR}/LLVMLibDeps.cmake.tmp)
+
+add_custom_command(OUTPUT ${LLVMLibDeps_TMP}
+ COMMAND sed -e s'@\\.a@@g' -e s'@\\.so@@g' -e 's@libLLVM@LLVM@g' -e 's@: @ @' -e 's@\\\(.*\\\)@set\(MSVC_LIB_DEPS_\\1\)@' ${FINAL_LIBDEPS} > ${LLVMLibDeps_TMP}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LLVMLibDeps_TMP} ${LLVMLibDeps}
+ DEPENDS ${FINAL_LIBDEPS}
+ COMMENT "Updating cmake library dependencies file ${LLVMLibDeps}"
+ )
+
+if( LLVM_TARGETS_TO_BUILD STREQUAL LLVM_ALL_TARGETS )
+ add_custom_target(llvmlibdeps.target ALL DEPENDS ${LLVMLibDeps_TMP})
+ add_dependencies(llvmlibdeps.target llvm-config.target)
+ set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} llvmlibdeps.target)
+endif()
+
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)