From b480eb069bb2c4147935159ee5710a5ed78485dd Mon Sep 17 00:00:00 2001 From: Florian Walch Date: Tue, 8 Sep 2015 12:09:44 +0200 Subject: CMake: Don't use existing third-party sources by default. Introduce ALLOW_EXISTING_SRC_DIR option, turned off by default. The Homebrew formula, which downloads and extracts the third-party dependency sources before starting the build, would turn this option ON. --- third-party/cmake/DownloadAndExtractFile.cmake | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'third-party/cmake/DownloadAndExtractFile.cmake') diff --git a/third-party/cmake/DownloadAndExtractFile.cmake b/third-party/cmake/DownloadAndExtractFile.cmake index 305e37e7dd..24e431b5e5 100644 --- a/third-party/cmake/DownloadAndExtractFile.cmake +++ b/third-party/cmake/DownloadAndExtractFile.cmake @@ -22,12 +22,15 @@ 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() +if(USE_EXISTING_SRC_DIR) + 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() + message(FATAL_ERROR "USE_EXISTING_SRC_DIR set to ON, but '${SRC_DIR}' does not exist or is empty.") endif() # Taken from ExternalProject_Add. Let's hope we can drop this one day when -- cgit