[CMake] No token <DOWNLOAD_DIR> in ExternalProject

cmake at web.de cmake at web.de
Tue Nov 28 04:16:26 EST 2017


Thanks for the link and the suggestion. The latter is similar to one of the things I've tried - splitting the external project into two external projects with one just managing the download. It seemed like a workaround for something which I expected to be an usual use case. Hence I thought I might be missing something. This doesn’t seem to be the case, so I’ll submit a feature request to add a token <DOWNLOAD_DIR>.

Thanks again,
Bjorn

> On 27. Nov 2017, at 13:12, Craig Scott <craig.scott at crascit.com> wrote:
> 
> 
> 
> 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. 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



More information about the CMake mailing list