| 1 |
# Distributed under the original FontForge BSD 3-clause license |
| 2 |
|
| 3 |
#[=======================================================================[.rst: |
| 4 |
DownloadIfMissing |
| 5 |
----------------- |
| 6 |
|
| 7 |
A small helper script to download or copy a file to ``DEST`` if it does |
| 8 |
not exist. If it is found in ``SOURCE``, it is copied to ``DEST``. |
| 9 |
Otherwise, the file is downloaded from ``URL`. |
| 10 |
|
| 11 |
Used to download some supplementary fonts for the test suite. |
| 12 |
|
| 13 |
#]=======================================================================] |
| 14 |
|
| 15 |
if(NOT EXISTS "${DEST}") |
| 16 |
if(EXISTS "${SOURCE}") |
| 17 |
message(STATUS "Copying ${SOURCE} to ${DEST}...") |
| 18 |
configure_file("${SOURCE}" "${DEST}" COPYONLY) |
| 19 |
else() |
| 20 |
message(STATUS "Fetching ${URL} to ${DEST}...") |
| 21 |
file(DOWNLOAD "${URL}" "${DEST}") |
| 22 |
endif() |
| 23 |
endif() |