summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/file-DOWNLOAD/common.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/file-DOWNLOAD/common.cmake')
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/common.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/Tests/RunCMake/file-DOWNLOAD/common.cmake b/Tests/RunCMake/file-DOWNLOAD/common.cmake
new file mode 100644
index 0000000..6aa2fe6
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/common.cmake
@@ -0,0 +1,15 @@
+if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/")
+ set(slash /)
+endif()
+set(url "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/input.png")
+set(file ${CMAKE_CURRENT_BINARY_DIR}/output.png)
+
+function(file_download)
+ file(DOWNLOAD "${url}"
+ ${file} # leave unquoted
+ TIMEOUT 30
+ STATUS status
+ ${ARGN}
+ )
+ message(STATUS "status='${status}'")
+endfunction()