llvm-capstone/llvm/cmake/modules/LLVMInstallSymlink.cmake
Michael Platings 5c602c46b1 Use LLVM_USE_SYMLINKS option in install_symlink
The change to potentially use symlinks on Windows was added in
https://reviews.llvm.org/D99170.

LLVM_USE_SYMLINKS was added more recently in
https://reviews.llvm.org/D135578 and allows specifying at configure time
whether or not symlinks should be created. The benefit of using this
option is it allows building the package on a symlink-capable Windows
machine with symlinks disabled so that the resulting package can be used
on a Windows machine that doesn't support symlinks.

Differential Revision: https://reviews.llvm.org/D145443
2023-03-08 07:26:27 +00:00

27 lines
825 B
CMake

# We need to execute this script at installation time because the
# DESTDIR environment variable may be unset at configuration time.
# See PR8397.
# Set to an arbitrary directory to silence GNUInstallDirs warnings
# regarding being unable to determine libdir.
set(CMAKE_INSTALL_LIBDIR "lib")
include(GNUInstallDirs)
function(install_symlink name target outdir link_or_copy)
# link_or_copy is the "command" to pass to cmake -E.
# It should be either "create_symlink" or "copy".
set(DESTDIR $ENV{DESTDIR})
if(NOT IS_ABSOLUTE "${outdir}")
set(outdir "${CMAKE_INSTALL_PREFIX}/${outdir}")
endif()
set(outdir "${DESTDIR}${outdir}")
message(STATUS "Creating ${name}")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E ${link_or_copy} "${target}" "${name}"
WORKING_DIRECTORY "${outdir}")
endfunction()