llvm-project/llvm/cmake/modules/LLVMInstallSymlink.cmake
John Ericson d93a11c138 Revert "[llvm][cmake] Make llvm_install_symlink robust to absolute dirs."
https://lab.llvm.org/buildbot/#/builders/36/builds/16668 was the sort of
thing I saw before when this was part of D99484, and it makes some sense
now this would have something to do with it.

This reverts commit 58580e922a69d94859a2506c3053d8c066a1e38c.
2022-01-21 02:48:10 +00:00

23 lines
675 B
CMake

# We need to execute this script at installation time because the
# DESTDIR environment variable may be unset at configuration time.
# See PR8397.
include(GNUInstallDirs)
function(install_symlink name target outdir)
set(DESTDIR $ENV{DESTDIR})
set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}")
message(STATUS "Creating ${name}")
execute_process(
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()