1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[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
This commit is contained in:
Kirill Bobyrev 2021-04-07 11:23:10 +02:00
parent 9c76412adb
commit f1dff186b8

View File

@ -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()