153264f9eSMark Nunberg# DownloadLcbDeb(url location)
253264f9eSMark NunbergMACRO(DOWNLOAD_LCB_DEP url dest)
322fd6348SSergey Avseyev    FIND_PROGRAM(WGET wget)
422fd6348SSergey Avseyev    FIND_PROGRAM(CURL curl)
522fd6348SSergey Avseyev    IF(CURL)
622fd6348SSergey Avseyev        EXECUTE_PROCESS(COMMAND "${CURL}" "${url}" -L -o "${dest}" RESULT_VARIABLE DLRC)
7732bfdb5SMark Nunberg    ELSEIF(WGET)
8732bfdb5SMark Nunberg        EXECUTE_PROCESS(COMMAND "${WGET}" "${url}" -O "${dest}" RESULT_VARIABLE DLRC)
922fd6348SSergey Avseyev    ENDIF()
1022fd6348SSergey Avseyev    IF(NOT DLRC EQUAL 0)
1122fd6348SSergey Avseyev      MESSAGE(WARNING "Using buggy built-in CMake downloader")
1222fd6348SSergey Avseyev      FILE(DOWNLOAD ${url} ${dest} INACTIVITY_TIMEOUT 30 SHOW_PROGRESS STATUS RET)
1322fd6348SSergey Avseyev      LIST(GET RET 0 DLRC)
14732bfdb5SMark Nunberg    ENDIF()
15732bfdb5SMark Nunberg    IF(NOT DLRC EQUAL 0)
16732bfdb5SMark Nunberg        MESSAGE(FATAL_ERROR "Failed to download ${url}")
1753264f9eSMark Nunberg    ENDIF()
1853264f9eSMark NunbergENDMACRO()
19