[PATCH] D145443: Use LLVM_USE_SYMLINKS option in install_symlink
Michael Platings via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 7 23:27:13 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c602c46b1ef: Use LLVM_USE_SYMLINKS option in install_symlink (authored by michaelplatings).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145443/new/
https://reviews.llvm.org/D145443
Files:
llvm/cmake/modules/AddLLVM.cmake
llvm/cmake/modules/LLVMInstallSymlink.cmake
Index: llvm/cmake/modules/LLVMInstallSymlink.cmake
===================================================================
--- llvm/cmake/modules/LLVMInstallSymlink.cmake
+++ llvm/cmake/modules/LLVMInstallSymlink.cmake
@@ -7,7 +7,10 @@
set(CMAKE_INSTALL_LIBDIR "lib")
include(GNUInstallDirs)
-function(install_symlink name target outdir)
+function(install_symlink name target outdir link_or_copy)
+ # link_or_copy is the "command" to pass to cmake -E.
+ # It should be either "create_symlink" or "copy".
+
set(DESTDIR $ENV{DESTDIR})
if(NOT IS_ABSOLUTE "${outdir}")
set(outdir "${CMAKE_INSTALL_PREFIX}/${outdir}")
@@ -17,12 +20,7 @@
message(STATUS "Creating ${name}")
execute_process(
- COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}"
- WORKING_DIRECTORY "${outdir}" ERROR_VARIABLE has_err)
- if(CMAKE_HOST_WIN32 AND has_err)
- execute_process(
- COMMAND "${CMAKE_COMMAND}" -E copy "${target}" "${name}"
- WORKING_DIRECTORY "${outdir}")
- endif()
+ COMMAND "${CMAKE_COMMAND}" -E ${link_or_copy} "${target}" "${name}"
+ WORKING_DIRECTORY "${outdir}")
endfunction()
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -2049,13 +2049,19 @@
set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
+ if(LLVM_USE_SYMLINKS)
+ set(LLVM_LINK_OR_COPY create_symlink)
+ else()
+ set(LLVM_LINK_OR_COPY copy)
+ endif()
+
set(output_dir lib${LLVM_LIBDIR_SUFFIX})
if(WIN32 AND "${type}" STREQUAL "SHARED")
set(output_dir "${CMAKE_INSTALL_BINDIR}")
endif()
install(SCRIPT ${INSTALL_SYMLINK}
- CODE "install_symlink(\"${full_name}\" \"${full_dest}\" \"${output_dir}\")"
+ CODE "install_symlink(\"${full_name}\" \"${full_dest}\" \"${output_dir}\" \"${LLVM_LINK_OR_COPY}\")"
COMPONENT ${component})
endfunction()
@@ -2092,10 +2098,16 @@
set(full_dest llvm${CMAKE_EXECUTABLE_SUFFIX})
endif()
+ if(LLVM_USE_SYMLINKS)
+ set(LLVM_LINK_OR_COPY create_symlink)
+ else()
+ set(LLVM_LINK_OR_COPY copy)
+ endif()
+
set(output_dir "${${project}_TOOLS_INSTALL_DIR}")
install(SCRIPT ${INSTALL_SYMLINK}
- CODE "install_symlink(\"${full_name}\" \"${full_dest}\" \"${output_dir}\")"
+ CODE "install_symlink(\"${full_name}\" \"${full_dest}\" \"${output_dir}\" \"${LLVM_LINK_OR_COPY}\")"
COMPONENT ${component})
if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145443.503245.patch
Type: text/x-patch
Size: 2674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230308/5f4f577a/attachment.bin>
More information about the llvm-commits
mailing list