<html><head><style data-externalstyle="true">
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}

p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
</style></head><body><div data-externalstyle="false" style="font-family:Calibri,'Segoe UI',Meiryo,'Microsoft YaHei UI','Microsoft JhengHei UI','Malgun Gothic','Khmer UI','Nirmala UI',Tunga,'Lao UI',Ebrima,sans-serif;font-size:16px;"><div>&nbsp;</div><div>The simplest way is to&nbsp;make&nbsp;a&nbsp;“download only” ExternalProject, by using something like:</div><div>&nbsp;</div><div>&nbsp;&nbsp;&nbsp; ExternalProject_Add(proj</div><div>&nbsp;&nbsp;&nbsp; &nbsp; DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/downloads</div><div>&nbsp;&nbsp;&nbsp; &nbsp; URL http://...</div><div>&nbsp;&nbsp;&nbsp; &nbsp; URL_MD5 31267132687126...</div><div>&nbsp;&nbsp;&nbsp; &nbsp; CONFIGURE_COMMAND&nbsp;“”</div><div>&nbsp;&nbsp;&nbsp; &nbsp; BUILD_COMMAND&nbsp;“”</div><div>&nbsp;&nbsp;&nbsp; &nbsp; INSTALL_COMMAND&nbsp;“”</div><div>&nbsp;&nbsp;&nbsp; )</div><div>&nbsp;</div><div>&nbsp;</div><div>Alternatively, you could use add_custom_command to run a CMake script at build time that does the file(DOWNLOAD.</div><div>&nbsp;</div><div>&nbsp;&nbsp;&nbsp; add_custom_command(COMMAND ${CMAKE_COMMAND} -P</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ${CMAKE_CURRENT_SOURCE_DIR}/download.cmake)</div><div>&nbsp;</div><div>And then in download.cmake:</div><div>&nbsp;</div><div>&nbsp;&nbsp;&nbsp; file(DOWNLOAD .....)</div><div>&nbsp;</div><div>ExternalProject does all that for you, and even extracts tarballs and moves them into the SOURCE_DIR for you, which you can see if you poke around enough&nbsp;underneath the hood.</div><div>&nbsp;</div><div>&nbsp;</div><div>HTH,</div><div>David</div><div>&nbsp;</div><div data-signatureblock="true">&nbsp;</div>        <div style="border-top-color: rgb(225, 225, 225); border-top-width: 1px; border-top-style: solid;">                <strong>From:</strong>&nbsp;Luc J. Bourhis<br>                <strong>Sent:</strong>&nbsp;‎March‎ ‎11‎, ‎2013 ‎12‎:‎00‎ ‎PM<br>                <strong>To:</strong>&nbsp;cmake@cmake.org<br>                <strong>Subject:</strong>&nbsp;[CMake] file(DOWNLOAD ...) at build time<br>        </div>        <div>&nbsp;</div>Is there a simple pattern to make file(DOWNLOAD ...) do the actual<br>downloading at build time? I tried to understand how ExternalProject_Add<br>does it but to no avail.<br><br><br><br><br>-----<br>--<br>Luc J. Bourhis<br><br>--<br>View this message in context: http://cmake.3232098.n2.nabble.com/file-DOWNLOAD-at-build-time-tp7583578.html<br>Sent from the CMake mailing list archive at Nabble.com.<br>--<br><br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br><br>Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.cmake.org/mailman/listinfo/cmake<br></div></body></html>