Merge topic 'ExternalData-stop-forking-to-cmake'

b6c022eaa2 ExternalData: use `file(CREATE_LINK)`
01cc8bf930 ExternalData: use `file(COPY_FILE)` instead of forking CMake

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5875
This commit is contained in:
Brad King
2021-03-16 14:48:15 +00:00
committed by Kitware Robot
+3 -2
View File
@@ -941,10 +941,11 @@ function(_ExternalData_link_or_copy src dst)
file(RELATIVE_PATH tgt "${dst_dir}" "${src}")
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()
# Create a copy.
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${src}" "${tmp}" RESULT_VARIABLE result)
file(COPY_FILE "${src}" "${tmp}" RESULT result)
endif()
if(result)
file(REMOVE "${tmp}")