Skip to content

Commit f37ea62

Browse files
committed
[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
1 parent cd824a4 commit f37ea62

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

llvm/cmake/modules/LLVMInstallSymlink.cmake

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44

55
function(install_symlink name target outdir)
66
set(DESTDIR $ENV{DESTDIR})
7-
if(CMAKE_HOST_UNIX)
8-
set(LINK_OR_COPY create_symlink)
9-
else()
10-
set(LINK_OR_COPY copy)
11-
endif()
12-
137
set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
148

159
message(STATUS "Creating ${name}")
1610

1711
execute_process(
18-
COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}" "${name}"
19-
WORKING_DIRECTORY "${bindir}")
12+
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}"
13+
WORKING_DIRECTORY "${bindir}" ERROR_VARIABLE has_err)
14+
if(CMAKE_HOST_WIN32 AND has_err)
15+
execute_process(
16+
COMMAND "${CMAKE_COMMAND}" -E copy "${target}" "${name}"
17+
WORKING_DIRECTORY "${bindir}")
18+
endif()
2019

2120
endfunction()

0 commit comments

Comments
 (0)