[CMake] file(DOWNLOAD ...) at build time

Luc J. Bourhis luc_j_bourhis at mac.com
Mon Mar 11 12:34:06 EDT 2013


David Cole-2 wrote
> The simplest way is to make a “download only” ExternalProject, by using
> something like:
> [...]
> 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 underneath the hood.

The problem is that the file to download is a RPM and ExternalProject does
not know how to handle it.


David Cole-2 wrote
> Alternatively, you could use add_custom_command to run a CMake script at
> build time that does the file(DOWNLOAD.
> 
>     add_custom_command(COMMAND ${CMAKE_COMMAND} -P
> 
>       ${CMAKE_CURRENT_SOURCE_DIR}/download.cmake)
> 
> And then in download.cmake:
> 
>     file(DOWNLOAD .....)

As far as I understand, ExternalProject_Add creates the equivalent of
download.cmake and then use the -P trick. Would there be a way to put the
download.cmake inline the calling CMake script? Like a "heredoc"?

Thanks,




-----
--
Luc J. Bourhis

--
View this message in context: http://cmake.3232098.n2.nabble.com/file-DOWNLOAD-at-build-time-tp7583578p7583580.html
Sent from the CMake mailing list archive at Nabble.com.


More information about the CMake mailing list