lld-link: Unify symlink code with llvm-lib
llvm-svn: 246139
This commit is contained in:
parent
f71e8370d1
commit
895f9a7422
|
|
@ -11,18 +11,19 @@ target_link_libraries(lld
|
||||||
install(TARGETS lld
|
install(TARGETS lld
|
||||||
RUNTIME DESTINATION bin)
|
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)
|
if(UNIX)
|
||||||
set(command create_symlink)
|
set(LLD_LINK_OR_COPY create_symlink)
|
||||||
# Make relative symlink
|
set(lld_binary "lld${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
set(src "lld${CMAKE_EXECUTABLE_SUFFIX}")
|
|
||||||
else()
|
else()
|
||||||
set(command copy)
|
set(LLD_LINK_OR_COPY copy)
|
||||||
set(src "${LLVM_RUNTIME_OUTPUT_INTDIR}/lld${CMAKE_EXECUTABLE_SUFFIX}")
|
set(lld_binary "${LLVM_RUNTIME_OUTPUT_INTDIR}/lld${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
endif()
|
endif()
|
||||||
set(dst "${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link${CMAKE_EXECUTABLE_SUFFIX}")
|
|
||||||
add_custom_command(TARGET lld POST_BUILD
|
set(lld_link "${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
COMMAND ${CMAKE_COMMAND} -E ${command} ${src} ${dst})
|
|
||||||
|
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}\")
|
install(SCRIPT install_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||||
|
|
|
||||||
|
|
@ -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)
|
if(UNIX)
|
||||||
set(LINK_OR_COPY create_symlink)
|
set(LINK_OR_COPY create_symlink)
|
||||||
set(DESTDIR $ENV{DESTDIR})
|
set(DESTDIR $ENV{DESTDIR})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue