diff --git a/llvm/cmake/modules/LLVMInstallSymlink.cmake b/llvm/cmake/modules/LLVMInstallSymlink.cmake --- a/llvm/cmake/modules/LLVMInstallSymlink.cmake +++ b/llvm/cmake/modules/LLVMInstallSymlink.cmake @@ -3,19 +3,17 @@ # See PR8397. 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()