[CMake] file(DOWNLOAD) and HTTP 302 (redirect)

David Cole david.cole at kitware.com
Fri Jun 4 07:55:17 EDT 2010


What if you do something this...? What do status and log tell you?

set(remote "http://......")
set(local "some file name")

file(DOWNLOAD

  "${remote}"

  "${local}"

  STATUS status

  LOG log)


list(GET status 0 status_code)

list(GET status 1 status_string)


if(NOT status_code EQUAL 0)

  message(FATAL_ERROR "error: downloading '${remote}' failed

  status_code: ${status_code}

  status_string: ${status_string}

  log: ${log}

")

endif()



On Fri, Jun 4, 2010 at 4:00 AM, Michael Wild <themiwi at gmail.com> wrote:

> When downloading something from http://downloads.sourceforge.net/... you
> always get a 302 redirect to one of the many mirror servers. Unfortunately,
> it seems that file(DOWNLOAD ...) doesn't follow the redirect, but just stops
> and leaves an empty file behind. No error, no nothing. Is this intentional?
>
> I'd rather not use a specific mirror...
>
> Michael
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100604/b73a4b2c/attachment.htm>


More information about the CMake mailing list