[PATCH] D12324: lld: unify symlink
Martell Malone via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 10:59:25 PDT 2015
martell created this revision.
martell added a reviewer: ruiu.
martell added subscribers: lld, llvm-commits.
martell set the repository for this revision to rL LLVM.
Not sure if commit r245266 came from D12029 or not but I had a bit more code to go in.
This unifies the CMakeLists.txt to make it closer to the variable names used in llvm-lib.
As well as highlights the reason for the post install script
Repository:
rL LLVM
http://reviews.llvm.org/D12324
Files:
tools/lld/CMakeLists.txt
tools/lld/install_symlink.cmake
Index: tools/lld/install_symlink.cmake
===================================================================
--- tools/lld/install_symlink.cmake
+++ tools/lld/install_symlink.cmake
@@ -1,3 +1,6 @@
+# We need to execute this script at installation time because the
+# DESTDIR environment variable may be unset at configuration time.
+# See PR8397.
if(UNIX)
set(LINK_OR_COPY create_symlink)
set(DESTDIR $ENV{DESTDIR})
Index: tools/lld/CMakeLists.txt
===================================================================
--- tools/lld/CMakeLists.txt
+++ tools/lld/CMakeLists.txt
@@ -11,18 +11,19 @@
install(TARGETS lld
RUNTIME DESTINATION bin)
-# Create the lld-link[.exe] symlink in the build directory. If symlink is not
-# supported by the operating system, create a copy instead.
if(UNIX)
- set(command create_symlink)
- # Make relative symlink
- set(src "lld${CMAKE_EXECUTABLE_SUFFIX}")
+ set(LLD_LINK_OR_COPY create_symlink)
+ set(lld_binary "lld${CMAKE_EXECUTABLE_SUFFIX}")
+
else()
- set(command copy)
- set(src "${LLVM_RUNTIME_OUTPUT_INTDIR}/lld${CMAKE_EXECUTABLE_SUFFIX}")
+ set(LLD_LINK_OR_COPY copy)
+ set(lld_binary "${LLVM_RUNTIME_OUTPUT_INTDIR}/lld${CMAKE_EXECUTABLE_SUFFIX}")
endif()
-set(dst "${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link${CMAKE_EXECUTABLE_SUFFIX}")
-add_custom_command(TARGET lld POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E ${command} ${src} ${dst})
+
+set(lld_link "${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link${CMAKE_EXECUTABLE_SUFFIX}")
+
+add_custom_command(OUTPUT ${lld_link}
+ COMMAND ${CMAKE_COMMAND} -E ${LLD_LINK_OR_COPY} "${lld_binary}" "${lld_link}"
+ DEPENDS lld)
install(SCRIPT install_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12324.33090.patch
Type: text/x-patch
Size: 1740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150825/9e9b2038/attachment.bin>
More information about the llvm-commits
mailing list