Changeset View
Changeset View
Standalone View
Standalone View
llvm/cmake/modules/LLVMInstallSymlink.cmake
# We need to execute this script at installation time because the | # We need to execute this script at installation time because the | ||||
# DESTDIR environment variable may be unset at configuration time. | # DESTDIR environment variable may be unset at configuration time. | ||||
# See PR8397. | # See PR8397. | ||||
include(GNUInstallDirs) | include(GNUInstallDirs) | ||||
function(install_symlink name target outdir) | function(install_symlink name target outdir) | ||||
set(DESTDIR $ENV{DESTDIR}) | set(DESTDIR $ENV{DESTDIR}) | ||||
set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}") | GNUInstallDirs_get_absolute_install_dir(bindir "${outdir}" BINDIR) | ||||
set(bindir "${DESTDIR}${bindir}") | |||||
message(STATUS "Creating ${name}") | message(STATUS "Creating ${name}") | ||||
execute_process( | execute_process( | ||||
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}" | COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}" | ||||
WORKING_DIRECTORY "${bindir}" ERROR_VARIABLE has_err) | WORKING_DIRECTORY "${bindir}" ERROR_VARIABLE has_err) | ||||
if(CMAKE_HOST_WIN32 AND has_err) | if(CMAKE_HOST_WIN32 AND has_err) | ||||
execute_process( | execute_process( | ||||
COMMAND "${CMAKE_COMMAND}" -E copy "${target}" "${name}" | COMMAND "${CMAKE_COMMAND}" -E copy "${target}" "${name}" | ||||
WORKING_DIRECTORY "${bindir}") | WORKING_DIRECTORY "${bindir}") | ||||
endif() | endif() | ||||
endfunction() | endfunction() |