[llvm] 58580e9 - [llvm][cmake] Make `llvm_install_symlink` robust to absolute dirs.

John Ericson via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 20 18:10:56 PST 2022


Author: John Ericson
Date: 2022-01-21T02:10:50Z
New Revision: 58580e922a69d94859a2506c3053d8c066a1e38c

URL: https://github.com/llvm/llvm-project/commit/58580e922a69d94859a2506c3053d8c066a1e38c
DIFF: https://github.com/llvm/llvm-project/commit/58580e922a69d94859a2506c3053d8c066a1e38c.diff

LOG: [llvm][cmake] Make `llvm_install_symlink` robust to absolute dirs.

If `CMAKE_INSTALL_BINDIR` is a different absolute path per project, as
it is with NixOS when we install every package to its own prefix, the
old way fails when the absolute path gets prepended.

There are still some issues with dowstream packages using `LLVM_TOOLS_INSTALL_DIR` which also may be absolute and just for LLVM proper, but that will be addressed in a future commit.

Differential Revision: https://reviews.llvm.org/D101070

Added: 
    

Modified: 
    llvm/cmake/modules/LLVMInstallSymlink.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/LLVMInstallSymlink.cmake b/llvm/cmake/modules/LLVMInstallSymlink.cmake
index b5c35f706cb7..ef7f5ab5288d 100644
--- a/llvm/cmake/modules/LLVMInstallSymlink.cmake
+++ b/llvm/cmake/modules/LLVMInstallSymlink.cmake
@@ -6,7 +6,8 @@ include(GNUInstallDirs)
 
 function(install_symlink name target outdir)
   set(DESTDIR $ENV{DESTDIR})
-  set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}")
+  GNUInstallDirs_get_absolute_install_dir(bindir "${outdir}" BINDIR)
+  set(bindir "${DESTDIR}${bindir}")
 
   message(STATUS "Creating ${name}")
 


        


More information about the llvm-commits mailing list