mirror of
https://github.com/reactos/CMake.git
synced 2024-11-23 11:39:48 +00:00
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 <matt.mccormick@kitware.com>
This commit is contained in:
parent
3541fc73a1
commit
0de47b05f7
7
Help/release/dev/ExternalData-no-symlinks.rst
Normal file
7
Help/release/dev/ExternalData-no-symlinks.rst
Normal file
@ -0,0 +1,7 @@
|
||||
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)
|
||||
|
8
Tests/Module/ExternalData/DataNoSymlinks/CMakeLists.txt
Normal file
8
Tests/Module/ExternalData/DataNoSymlinks/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
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)
|
1
Tests/Module/ExternalData/DataNoSymlinks/Data.dat.md5
Normal file
1
Tests/Module/ExternalData/DataNoSymlinks/Data.dat.md5
Normal file
@ -0,0 +1 @@
|
||||
8c018830e3efa5caf3c7415028335a57
|
@ -0,0 +1,6 @@
|
||||
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()
|
Loading…
Reference in New Issue
Block a user