summaryrefslogtreecommitdiff
path: root/tools/llvm-config
diff options
context:
space:
mode:
authorOscar Fuentes <ofv@wanadoo.es>2009-08-14 16:59:41 +0000
committerOscar Fuentes <ofv@wanadoo.es>2009-08-14 16:59:41 +0000
commit94d38e561b5985390c075abd0eaf4a7caa25b005 (patch)
tree779e7560cbf65e1cc5e08bca7b1499e77c585e71 /tools/llvm-config
parent717f1dcfac996b2ab6eb34754519392a907478af (diff)
downloadllvm-94d38e561b5985390c075abd0eaf4a7caa25b005.tar.gz
llvm-94d38e561b5985390c075abd0eaf4a7caa25b005.tar.bz2
llvm-94d38e561b5985390c075abd0eaf4a7caa25b005.tar.xz
CMake: Automatic regeneration of the library dependencies file.
It doesn't stop or reconfigure the build, though, so the user will see a broken build that magically succeeds at the next attempt. It is technically possible to halt the build with a helpful message, and even to automatically restart the build using the new dependencies as it we did when llvm-config was used by cmake for learning dependencies. This is left on the TODO list. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-config')
-rw-r--r--tools/llvm-config/CMakeLists.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
index 4873794635..b029663011 100644
--- a/tools/llvm-config/CMakeLists.txt
+++ b/tools/llvm-config/CMakeLists.txt
@@ -124,4 +124,26 @@ install(FILES ${LLVM_CONFIG}
WORLD_READ WORLD_EXECUTE
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@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)