From b6c022eaa27abcc265a5961b22e5e0c44df88752 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 2 Mar 2021 14:51:22 -0500 Subject: [PATCH] ExternalData: use `file(CREATE_LINK)` This avoids spawning a new CMake command which isn't necessary. --- Modules/ExternalData.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 032e423c09..1850e74625 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -941,7 +941,8 @@ 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. file(COPY_FILE "${src}" "${tmp}" RESULT result)