[llvm] cdf8c7b - Revert "[llvm][cmake] Make `install_symlink` workflow work with absolute install dirs"

John Ericson via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 14:16:13 PDT 2022


Author: John Ericson
Date: 2022-07-25T21:15:14Z
New Revision: cdf8c7b1af77315d30e59863b0a2aa2ac65356fe

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

LOG: Revert "[llvm][cmake] Make `install_symlink` workflow work with absolute install dirs"

`ExtendPath` needs to be moved from internal to external CMake if it is
to be used to `AddLLVM`. See, for example, the failure in
https://lab.llvm.org/buildbot#builders/61/builds/29940

This reverts commit 5acd376438a53747c84e38c8b69fc74a270da680.

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake
    llvm/cmake/modules/LLVMInstallSymlink.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 4b72a42c2b06b..365742d3e8357 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1,5 +1,4 @@
 include(GNUInstallDirs)
-include(ExtendPath)
 include(LLVMDistributionSupport)
 include(LLVMProcessSources)
 include(LLVM-Config)
@@ -1954,7 +1953,7 @@ endfunction()
 function(add_lit_testsuites project directory)
   if (NOT LLVM_ENABLE_IDE)
     cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "FOLDER" "PARAMS;DEPENDS;ARGS" ${ARGN})
-
+    
     if (NOT ARG_FOLDER)
       set(ARG_FOLDER "Test Subdirectories")
     endif()
@@ -2010,14 +2009,11 @@ function(llvm_install_library_symlink name dest type)
 
   set(output_dir lib${LLVM_LIBDIR_SUFFIX})
   if(WIN32 AND "${type}" STREQUAL "SHARED")
-    set(output_dir "${CMAKE_INSTALL_BINDIR}")
+    set(output_dir bin)
   endif()
 
-  # `install_symlink` needs an absoute path.
-  extend_path(output_dir "${CMAKE_INSTALL_PREFIX}" "${output_dir}")
-
   install(SCRIPT ${INSTALL_SYMLINK}
-          CODE "install_symlink(\"${full_name}\" \"${full_dest}\" \"${output_dir}\")"
+          CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
           COMPONENT ${component})
 
 endfunction()
@@ -2052,11 +2048,8 @@ function(llvm_install_symlink project name dest)
     set(full_dest llvm${CMAKE_EXECUTABLE_SUFFIX})
   endif()
 
-  # `install_symlink` needs an absoute path.
-  extend_path(output_dir "${CMAKE_INSTALL_PREFIX}" "${${project}_TOOLS_INSTALL_DIR}")
-
   install(SCRIPT ${INSTALL_SYMLINK}
-          CODE "install_symlink(\"${full_name}\" \"${full_dest}\" \"${output_dir}\")"
+          CODE "install_symlink(${full_name} ${full_dest} ${${project}_TOOLS_INSTALL_DIR})"
           COMPONENT ${component})
 
   if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)

diff  --git a/llvm/cmake/modules/LLVMInstallSymlink.cmake b/llvm/cmake/modules/LLVMInstallSymlink.cmake
index 29c096c020d6f..b5c35f706cb7e 100644
--- a/llvm/cmake/modules/LLVMInstallSymlink.cmake
+++ b/llvm/cmake/modules/LLVMInstallSymlink.cmake
@@ -1,26 +1,22 @@
 # We need to execute this script at installation time because the
 # DESTDIR environment variable may be unset at configuration time.
 # See PR8397.
-#
-# `outdir` must be an absolute path. This module gets a very reduced
-# `CMAKE_MODULE_PATH` so it is easier to make the caller the responsible
-# for this.
 
 include(GNUInstallDirs)
 
 function(install_symlink name target outdir)
   set(DESTDIR $ENV{DESTDIR})
-  set(outdir "${DESTDIR}${outdir}")
+  set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}")
 
   message(STATUS "Creating ${name}")
 
   execute_process(
     COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}"
-    WORKING_DIRECTORY "${outdir}" ERROR_VARIABLE has_err)
+    WORKING_DIRECTORY "${bindir}" ERROR_VARIABLE has_err)
   if(CMAKE_HOST_WIN32 AND has_err)
     execute_process(
       COMMAND "${CMAKE_COMMAND}" -E copy "${target}" "${name}"
-      WORKING_DIRECTORY "${outdir}")
+      WORKING_DIRECTORY "${bindir}")
   endif()
 
 endfunction()


        


More information about the llvm-commits mailing list