summaryrefslogtreecommitdiffstats
path: root/llvm/cmake
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-12-15 18:17:07 +0000
committerChris Bieneman <beanz@apple.com>2016-12-15 18:17:07 +0000
commitdc9b0db8e349e4b9a6344efa90f714280abbd493 (patch)
treefb2bc5c18fcbee0ceedc68f3c1a0bac114f9e3d7 /llvm/cmake
parent24f5776216937e7699a306be2990f6494d1c0670 (diff)
downloadbcm5719-llvm-dc9b0db8e349e4b9a6344efa90f714280abbd493.tar.gz
bcm5719-llvm-dc9b0db8e349e4b9a6344efa90f714280abbd493.zip
[CMake] Minor change to symlink generation for LLDB
If OUTPUT_DIR is not specified we can assume the symlink is linking to a file in the same directory, so we can use $<TARGET_FILE_NAME:${target}> to create a relative symlink. In the case of LLDB, when we build a framework, we are creating symlinks in a different directory than the file we're pointing to, and we don't install those links. To make this work in the build directory we can use $<TARGET_FILE:${target}> instead, which uses the full path to the target. llvm-svn: 289840
Diffstat (limited to 'llvm/cmake')
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 3f494b89b5f..f35fcf444d2 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1290,6 +1290,8 @@ endfunction()
function(add_llvm_tool_symlink link_name target)
cmake_parse_arguments(ARG "ALWAYS_GENERATE" "OUTPUT_DIR" "" ${ARGN})
+ set(dest_binary "$<TARGET_FILE:${target}>")
+
# This got a bit gross... For multi-configuration generators the target
# properties return the resolved value of the string, not the build system
# expression. To reconstruct the platform-agnostic path we have to do some
@@ -1298,6 +1300,11 @@ function(add_llvm_tool_symlink link_name target)
# and replace it with CMAKE_CFG_INTDIR. This allows the build step to be type
# agnostic again.
if(NOT ARG_OUTPUT_DIR)
+ # If you're not overriding the OUTPUT_DIR, we can make the link relative in
+ # the same directory.
+ if(UNIX)
+ set(dest_binary "$<TARGET_FILE_NAME:${target}>")
+ endif()
if(CMAKE_CONFIGURATION_TYPES)
list(GET CMAKE_CONFIGURATION_TYPES 0 first_type)
string(TOUPPER ${first_type} first_type_upper)
@@ -1323,10 +1330,8 @@ function(add_llvm_tool_symlink link_name target)
if(UNIX)
set(LLVM_LINK_OR_COPY create_symlink)
- set(dest_binary "$<TARGET_FILE_NAME:${target}>")
else()
set(LLVM_LINK_OR_COPY copy)
- set(dest_binary "$<TARGET_FILE:${target}>")
endif()
set(output_path "${ARG_OUTPUT_DIR}/${link_name}${CMAKE_EXECUTABLE_SUFFIX}")
OpenPOWER on IntegriCloud