I'm pretty sure the original intent was for file(DOWNLOAD ...) to not raise errors so that scripts can analyze status and log and decide what to do next rather than forcing a CMake error...<div><br></div><div>I recently added EXPECTED_MD5 to file(DOWNLOAD in the 'next' branch of CMake. If a download fails when there's an expected MD5 sum given, then it *does* raise an error. Perhaps you'll find that useful in the next release...</div>
<div><br></div><div>Cheers,</div><div>David C.</div><div><br></div><div><br></div><div><div class="gmail_quote">On Fri, Jun 4, 2010 at 7:55 AM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">What if you do something this...? What do status and log tell you?<div><br></div><div>set(remote "http://......")</div>
<div>set(local "some file name")</div><div><br><div><p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24">
file(DOWNLOAD</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24"> "${remote}"</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24"> "${local}"</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24"> STATUS status</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24"> LOG log)</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24;min-height:16.0px"><br></p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24">list(GET status 0 status_code)</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24">list(GET status 1 status_string)</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24;min-height:16.0px"><br></p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24">if(NOT status_code EQUAL 0)</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24"> message(FATAL_ERROR "error: downloading '${remote}' failed</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24"> status_code: ${status_code}</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24"> status_string: ${status_string}</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24"> log: ${log}</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24">")</p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24">endif()</p><div><div></div><div class="h5">
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24;min-height:16.0px"><br></p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:14.0px Menlo;color:#da2e24"><font color="#000000" face="arial"><span style="font-size:small"><font color="#DA2E24" face="Menlo" size="4"><span style="font-size:14px"><br>
</span></font></span></font></p><div class="gmail_quote">On Fri, Jun 4, 2010 at 4:00 AM, Michael Wild <span dir="ltr"><<a href="mailto:themiwi@gmail.com" target="_blank">themiwi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When downloading something from <a href="http://downloads.sourceforge.net/." target="_blank">http://downloads.sourceforge.net/.</a>.. 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?<br>
<br>
I'd rather not use a specific mirror...<br>
<br>
Michael<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>