1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 05:26:58 +08:00

ExternalData: use file(CREATE_LINK)

This avoids spawning a new CMake command which isn't necessary.
This commit is contained in:
Ben Boeckel
2021-03-02 14:51:22 -05:00
parent 01cc8bf930
commit b6c022eaa2

View File

@@ -941,7 +941,8 @@ function(_ExternalData_link_or_copy src dst)
file(RELATIVE_PATH tgt "${dst_dir}" "${src}") file(RELATIVE_PATH tgt "${dst_dir}" "${src}")
endif() endif()
endif() endif()
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${tgt}" "${tmp}" RESULT_VARIABLE result) # Create link (falling back to copying if there's a problem).
file(CREATE_LINK "${tgt}" "${tmp}" RESULT result COPY_ON_ERROR SYMBOLIC)
else() else()
# Create a copy. # Create a copy.
file(COPY_FILE "${src}" "${tmp}" RESULT result) file(COPY_FILE "${src}" "${tmp}" RESULT result)