Commit 0de47b05 authored by Brad King's avatar Brad King

ExternalData: Add option to disable use of symlinks

Add an ExternalData_NO_SYMLINKS to enable use of copies instead of
symlinks to populate the real data files behind a DATA{} reference.
This will be useful on UNIX-like systems when the underlying filesystem
does not actually support symbolic links.
Suggested-by: Matt McCormick's avatarMatt McCormick <matt.mccormick@kitware.com>
parent 3541fc73
ExternalData-no-symlinks
------------------------
* The :module:`ExternalData` module learned a new
:variable:`ExternalData_NO_SYMLINKS` option to disable use of
symbolic links to populate the real data files and use copies
instead.
......@@ -117,6 +117,13 @@ calling any of the functions provided by this module.
data fetch rule created for the content link will use the staged
object if it cannot be found using any URL template.
.. variable:: ExternalData_NO_SYMLINKS
The real data files named by expanded ``DATA{}`` references may be made
available under ``ExternalData_BINARY_ROOT`` using symbolic links on
some platforms. The ``ExternalData_NO_SYMLINKS`` variable may be set
to disable use of symbolic links and enable use of copies instead.
.. variable:: ExternalData_OBJECT_STORES
The ``ExternalData_OBJECT_STORES`` variable may be set to a list of local
......@@ -842,7 +849,7 @@ function(_ExternalData_link_or_copy src dst)
file(MAKE_DIRECTORY "${dst_dir}")
_ExternalData_random(random)
set(tmp "${dst}.tmp${random}")
if(UNIX)
if(UNIX AND NOT ExternalData_NO_SYMLINKS)
# Create a symbolic link.
set(tgt "${src}")
if(relative_top)
......
......@@ -2,4 +2,5 @@ set(ExternalData_OBJECT_STORES "@ExternalData_OBJECT_STORES@")
set(ExternalData_URL_TEMPLATES "@ExternalData_URL_TEMPLATES@")
set(ExternalData_TIMEOUT_INACTIVITY "@ExternalData_TIMEOUT_INACTIVITY@")
set(ExternalData_TIMEOUT_ABSOLUTE "@ExternalData_TIMEOUT_ABSOLUTE@")
set(ExternalData_NO_SYMLINKS "@ExternalData_NO_SYMLINKS@")
@_ExternalData_CONFIG_CODE@
......@@ -53,3 +53,4 @@ ExternalData_Add_Target(Data1)
add_subdirectory(Data2)
add_subdirectory(Data3)
add_subdirectory(Data4)
add_subdirectory(DataNoSymlinks)
set(ExternalData_NO_SYMLINKS 1)
ExternalData_Add_Test(DataNoSymlinks
NAME DataNoSymlinksCheck
COMMAND ${CMAKE_COMMAND}
-D Data=DATA{Data.dat}
-P ${CMAKE_CURRENT_SOURCE_DIR}/DataNoSymlinksCheck.cmake
)
ExternalData_Add_Target(DataNoSymlinks)
if(NOT EXISTS "${Data}")
message(SEND_ERROR "Input file:\n ${Data}\ndoes not exist!")
endif()
if(IS_SYMLINK "${Data}")
message(SEND_ERROR "Input file:\n ${Data}\nis a symlink but should not be!")
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment