forked from OSchip/llvm-project
[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:
parent
cd824a48cc
commit
f37ea62e57
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue