add_llvm_executable(lld
  lld.cpp
  )

target_link_libraries(lld
  lldDriver
  lldCOFF
  LLVMSupport
  )

install(TARGETS lld
  RUNTIME DESTINATION bin)

if(UNIX)
  set(LLD_LINK_OR_COPY create_symlink)
  set(lld_binary "lld${CMAKE_EXECUTABLE_SUFFIX}")

else()
  set(LLD_LINK_OR_COPY copy)
  set(lld_binary "${LLVM_RUNTIME_OUTPUT_INTDIR}/lld${CMAKE_EXECUTABLE_SUFFIX}")
endif()

set(lld_link "${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link${CMAKE_EXECUTABLE_SUFFIX}")

add_custom_command(TARGET lld POST_BUILD
                   COMMAND ${CMAKE_COMMAND} -E ${LLD_LINK_OR_COPY} "${lld_binary}" "${lld_link}")

install(SCRIPT install_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")

add_llvm_executable(lld
  lld.cpp
  )

target_link_libraries(lld
  lldDriver
  lldCOFF
  LLVMSupport
  )

install(TARGETS lld
  RUNTIME DESTINATION bin)

if(NOT LLD_SYMLINKS_TO_CREATE)
  set(LLD_SYMLINKS_TO_CREATE lld-link)
endif()

foreach(link ${LLD_SYMLINKS_TO_CREATE})
  add_llvm_tool_symlink(${link} lld ALWAYS_GENERATE)
  # Always generate install targets
  llvm_install_symlink(${link} lld ALWAYS_GENERATE)
endforeach()


Move LLD to the new style for symlink generation, and make the links list overridable.
[CMake] Move LLD to the new style for symlink generation, and make the links list overridable.

Reviewers: lhames, rafael

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D13136

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@248544 91177308-0d34-0410-b5e6-96231b3b80d8
