[CMake] No token <DOWNLOAD_DIR> in ExternalProject

Craig Scott craig.scott at crascit.com
Mon Nov 27 07:12:21 EST 2017


On Mon, Nov 27, 2017 at 10:22 PM, <cmake at web.de> wrote:

> Hello all,
>
> I'm surprised that there is no token <DOWNLOAD_DIR> available in
> ExternalProject.
>
> As written in the documentation [1] there are tokens <SOURCE_DIR>, <SOURCE_
> SUBDIR>, <BINARY_DIR>, <INSTALL_DIR>, and <TMP_DIR>. But <DOWNLOAD_DIR>
> seems to be missing.
>

The relevant part of the module code is here
<https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/ExternalProject.cmake#L1664-1674>.
It does seem to be an unexpected omission, but I don't know if there's a
reason for it or not.




>
> However if I have an external project with a custom DOWNLOAD_COMMAND it
> would be handy to be able to use <DOWNLOAD_DIR> in the following steps.
>
> Is there another way to know the download directory without setting it
> explicitely?
>

You can retrieve it with ExternalProject_Get_Property(myExtProj
DOWNLOAD_DIR), which will store the result in a variable also named
DOWNLOAD_DIR. That's a bit tricky though, since you can only call that
after you've defined the download command in your ExternalProject_Add()
call. You could define a custom step in a subsequent call and perhaps set
up dependencies between steps to get the behaviour you want, but it does
seem unnecessarily fiddly.




-- 
Craig Scott
Melbourne, Australia
https://crascit.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171127/9bc4e07e/attachment.html>


More information about the CMake mailing list