aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXu Cheng <xucheng@me.com>2014-11-08 19:11:13 +0800
committerXu Cheng <xucheng@me.com>2014-11-08 20:14:32 +0800
commitcca2c089cf844d74a3e1ac772d6276ac71743326 (patch)
treeb2d7f454f97f92426768ac2bfb7fb2b4158f0ac8
parent5d0f8b63e344c13ae32d43389e22537aa8e3da4d (diff)
downloadrneovim-cca2c089cf844d74a3e1ac772d6276ac71743326.tar.gz
rneovim-cca2c089cf844d74a3e1ac772d6276ac71743326.tar.bz2
rneovim-cca2c089cf844d74a3e1ac772d6276ac71743326.zip
build: don't download and extract tarball if source is already present
When building under Homebrew, we want to let Homebrew manage downloading and extracting the tarballs. See PR #1411. Also make sure to skip only if directory is not empty. Fix #1433.
-rw-r--r--third-party/cmake/DownloadAndExtractFile.cmake14
1 files changed, 12 insertions, 2 deletions
diff --git a/third-party/cmake/DownloadAndExtractFile.cmake b/third-party/cmake/DownloadAndExtractFile.cmake
index 14873793d9..eb5c1c6602 100644
--- a/third-party/cmake/DownloadAndExtractFile.cmake
+++ b/third-party/cmake/DownloadAndExtractFile.cmake
@@ -18,6 +18,18 @@ if(NOT DEFINED TARGET)
message(FATAL_ERROR "TARGET must be defined.")
endif()
+set(SRC_DIR ${PREFIX}/src/${TARGET})
+
+# Check whether the source has been downloaded. If true, skip it.
+# Useful for external downloads like homebrew.
+if(EXISTS "${SRC_DIR}" AND IS_DIRECTORY "${SRC_DIR}")
+ file(GLOB EXISTED_FILES "${SRC_DIR}/*")
+ if(EXISTED_FILES)
+ message(STATUS "${SRC_DIR} is found and not empty, skipping download and extraction. ")
+ return()
+ endif()
+endif()
+
# Taken from ExternalProject_Add. Let's hope we can drop this one day when
# ExternalProject_Add allows you to disable SHOW_PROGRESS on the file download.
if(TIMEOUT)
@@ -71,8 +83,6 @@ endif()
message(STATUS "downloading... done")
-set(SRC_DIR ${PREFIX}/src/${TARGET})
-
# Slurped from a generated extract-TARGET.cmake file.
message(STATUS "extracting...
src='${file}'