<div dir="ltr">You could try using file(MAKE_DIRECTORY ...) between the two ExternalProject_Add() calls to actually ensure the directory exists, but I'm not 100% sure whether this would not interfere with the download step when it goes to do that at build time. I'm pretty sure it works, but you should confirm it.<div><br></div><div>Another choice is to do the download at configure time rather than build time. This would mean the source would already be there by the time you reached the second ExternalProject_Add() call in your example. There are pros and cons to this, with the main objection being that ideally the configure step should be quick and making the download part of configure can increase the time that stage takes. For a general implementation supporting this functionality, have a look here:</div><div><br></div><div><a href="https://github.com/Crascit/DownloadProject">https://github.com/Crascit/DownloadProject</a><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 14, 2016 at 12:29 AM, Bo Zhou <span dir="ltr"><<a href="mailto:bo.schwarzstein@gmail.com" target="_blank">bo.schwarzstein@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi<div><br></div><div>In my project I have to compile the same external projects by the different generators, is that possible to handle this cases by ExternalProject_Add ?</div><div><br></div><div>I tried this way, firstly, just download the repository</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>ExternalProject_Add(OPENEXR_<wbr>DOWNLOAD</div><div>    PREFIX ${OPENEXR_PREFIX}</div><div>    GIT_REPOSITORY <a href="https://github.com/openexr/openexr.git" target="_blank">https://<wbr>github.com/openexr/openexr.git</a></div><div>    GIT_TAG v2.2.0</div><div>    CONFIGURE_COMMAND ""</div><div>    BUILD_COMMAND ""</div><div>    INSTALL_COMMAND "")</div></blockquote><div><br></div><div>ExternalProject_Get_Property(<wbr>OPENEXR_DOWNLOAD SOURCE_DIR)<br></div><div>SET(OPENEXR_SOURCE_DIR ${SOURCE_DIR})</div><div><br></div><div>Then I tried to create a specific new target to use specific generator</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>ExternalProject_Add(OPENEXR_<wbr>VC11</div></div><div><div>  DEPENDS OPENEXR_DOWNLOAD</div></div><div><div>  SOURCE_DIR ${OPENEXR_SOURCE_DIR}/IlmBase)</div></div></blockquote><div><br></div><div>Seems can't work, it requires an non-empty SOURCE_DIR, but before downloading, it's empty :(</div><div><br></div><div>So is there any better way to do this ? Thanks very much !</div><div><br></div></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div></div></div></div></div></div></div>
</div>