-# Copyright (C) 2018 Intel Corporation
+# Copyright (C) 2018-2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
-cmake_minimum_required (VERSION 2.8)
include (FindWget)
function (DownloadAndCheck from to fatal result)
- set(status_res "ON")
- set(output 1)
+ set(status_res "ON")
+ set(output 1)
- get_filename_component(download_dir ${to} DIRECTORY)
- if (NOT EXISTS ${download_dir})
- file(MAKE_DIRECTORY ${download_dir})
- endif()
+ get_filename_component(download_dir ${to} DIRECTORY)
+ if (NOT EXISTS ${download_dir})
+ file(MAKE_DIRECTORY ${download_dir})
+ endif()
- if(NOT EXISTS "${to}")
+ if(NOT EXISTS "${to}")
+ if (${from} MATCHES "(http:)|(https:)|(ftp:)")
message(STATUS "Downloading from ${from} to ${to} ...")
-
find_program(aria2c "aria2c")
if (${aria2c} STREQUAL "aria2c-NOTFOUND")
if (NOT ${WGET_FOUND})
status_code: ${status_code}")
endif()
endif()
+ else()
+ message(STATUS "Copying from local folder ${from} to ${to} ... ")
+ file(COPY ${from} DESTINATION ${download_dir})
endif()
+ endif()
file(REMOVE ${to}.md5)
set(${result} "${status_res}" PARENT_SCOPE)
-endfunction(DownloadAndCheck)
\ No newline at end of file
+endfunction(DownloadAndCheck)