[PATCH] D99170: [CMake] try creating symlink first on windows

Kirill Bobyrev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 7 02:23:36 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf37ea62e57b5: [CMake] try creating symlink first on windows (authored by kbobyrev).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99170/new/

https://reviews.llvm.org/D99170

Files:
  llvm/cmake/modules/LLVMInstallSymlink.cmake


Index: llvm/cmake/modules/LLVMInstallSymlink.cmake
===================================================================
--- llvm/cmake/modules/LLVMInstallSymlink.cmake
+++ llvm/cmake/modules/LLVMInstallSymlink.cmake
@@ -4,18 +4,17 @@
 
 function(install_symlink name target outdir)
   set(DESTDIR $ENV{DESTDIR})
-  if(CMAKE_HOST_UNIX)
-    set(LINK_OR_COPY create_symlink)
-  else()
-    set(LINK_OR_COPY copy)
-  endif()
-
   set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
 
   message(STATUS "Creating ${name}")
 
   execute_process(
-    COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}" "${name}"
-    WORKING_DIRECTORY "${bindir}")
+    COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}"
+    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 "${bindir}")
+  endif()
 
 endfunction()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99170.335760.patch
Type: text/x-patch
Size: 975 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210407/bea77176/attachment.bin>


More information about the llvm-commits mailing list