[PATCH] D130256: [CMake] Handle absolute paths for symlinks

Sebastian Neubauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 05:26:17 PDT 2022


sebastian-ne created this revision.
sebastian-ne added a reviewer: Ericson2314.
Herald added a subscriber: mgorny.
Herald added a project: All.
sebastian-ne requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The binary installation path can already be absolute. In that case,
we must not prepend CMAKE_INSTALL_PREFIX. extend_path is used in other
places to handle that, this patch adds it when creating symlinks like
clang++ or llvm-readelf.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130256

Files:
  llvm/cmake/modules/LLVMInstallSymlink.cmake


Index: llvm/cmake/modules/LLVMInstallSymlink.cmake
===================================================================
--- llvm/cmake/modules/LLVMInstallSymlink.cmake
+++ llvm/cmake/modules/LLVMInstallSymlink.cmake
@@ -4,9 +4,13 @@
 
 include(GNUInstallDirs)
 
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../cmake/Modules" ${CMAKE_MODULE_PATH})
+include(ExtendPath)
+
 function(install_symlink name target outdir)
   set(DESTDIR $ENV{DESTDIR})
-  set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}")
+  extend_path(prefixed_outdir "${CMAKE_INSTALL_PREFIX}" "${outdir}")
+  set(bindir "${DESTDIR}${prefixed_outdir}")
 
   message(STATUS "Creating ${name}")
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130256.446446.patch
Type: text/x-patch
Size: 675 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220721/72a2a9d2/attachment.bin>


More information about the llvm-commits mailing list