From: Kirill Bobyrev Date: Wed, 7 Apr 2021 09:23:10 +0000 (+0200) Subject: [CMake] try creating symlink first on windows X-Git-Tag: llvmorg-14-init~10253 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f37ea62e57b5e0e7b52102a2254288e205bfef89;p=platform%2Fupstream%2Fllvm.git [CMake] try creating symlink first on windows //-E create_symlink// is available on windows since CMake 3.13 (LLVM now uses 3.13.4) It may needs administrator privileges or enabled developer mode (Windows 10) See https://cmake.org/cmake/help/latest/release/3.13.html Reviewed By: kbobyrev Differential Revision: https://reviews.llvm.org/D99170 --- diff --git a/llvm/cmake/modules/LLVMInstallSymlink.cmake b/llvm/cmake/modules/LLVMInstallSymlink.cmake index 09fed80..3e6a2c9 100644 --- a/llvm/cmake/modules/LLVMInstallSymlink.cmake +++ b/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()