forked from OSchip/llvm-project
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
|
||||
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}\")
|
||||
|
|
|
@ -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})
|
||||
|
|
Loading…
Reference in New Issue