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:
Brad King
2015-05-22 09:15:07 -04:00
parent 3541fc73a1
commit 0de47b05f7
7 changed files with 32 additions and 1 deletions

View File

@@ -53,3 +53,4 @@ ExternalData_Add_Target(Data1)
add_subdirectory(Data2)
add_subdirectory(Data3)
add_subdirectory(Data4)
add_subdirectory(DataNoSymlinks)

View 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)

View File

@@ -0,0 +1 @@
8c018830e3efa5caf3c7415028335a57

View File

@@ -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()