Skip to content

Commit

Permalink
[CMake] Support symlinks with the same name as the binary
Browse files Browse the repository at this point in the history
This supports creating symlinks to tools in different directories than
the tool is built to. This is useful for the LLDB framework build which
I’m sending patches for shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281788 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Chris Bieneman committed Sep 16, 2016
1 parent 16150b3 commit 78279ce
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,12 @@ function(add_llvm_tool_symlink name dest)

set(output_path "${LLVM_RUNTIME_OUTPUT_INTDIR}/${name}${CMAKE_EXECUTABLE_SUFFIX}")

set(target_name ${name})
if(TARGET ${name})
set(target_name ${name}-link)
endif()


if(ARG_ALWAYS_GENERATE)
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES ${dest_binary})
Expand All @@ -1255,8 +1261,8 @@ function(add_llvm_tool_symlink name dest)
add_custom_command(OUTPUT ${output_path}
COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} "${dest_binary}" "${output_path}"
DEPENDS ${dest})
add_custom_target(${name} ALL DEPENDS ${output_path})
set_target_properties(${name} PROPERTIES FOLDER Tools)
add_custom_target(${target_name} ALL DEPENDS ${output_path})
set_target_properties(${target_name} PROPERTIES FOLDER Tools)

# Make sure the parent tool is a toolchain tool, otherwise exclude this tool
list(FIND LLVM_TOOLCHAIN_TOOLS ${dest} LLVM_IS_${dest}_TOOLCHAIN_TOOL)
Expand Down

0 comments on commit 78279ce

Please sign in to comment.