From 6ee60bcf9b8048e7cdbf7caf99c5340e7e72091f Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Fri, 16 Sep 2016 22:19:19 +0000 Subject: [PATCH] [CMake] Support symlinks with the same name as the binary MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. llvm-svn: 281788 --- llvm/cmake/modules/AddLLVM.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 46c9d33..94c08f5 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -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}) @@ -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) -- 2.7.4