[CMake] How to avoid continuous download while using ExternalProjects

David Cole david.cole at kitware.com
Wed Feb 10 11:37:48 EST 2010


If you want to trigger a "rebuild" of any given step (and later steps) for
an ExternalProject, simply open up the project folder in Visual Studio, so
you can see the list of steps. Right click on the step you want to re-do and
tell Visual Studio to "compile" the step.

With custom build steps, "compiling" is executing the custom command for the
step. If you re-execute an earlier step in the chain, all the subsequent
steps should also rebuild because of the dependencies among the stamp files.

This is a finer-grained way to get the same effect you got from the "clean"
without re-executing the download step.

If you want to avoid re-executing the download step, then you have to avoid
using "clean" or you have to move the download step to something truly
external.

One idea might be to add a chain of external projects that *only* do
download steps, and make each of your configure/build/install external
projects depend on *that* download-only external project.


If anybody has other ideas to share downloads between "Release" and "Debug"
configurations, or other ways to avoid "unnecessary" downloads better, or
other ideas for any ExternalProject improvement, I'm all ears. :-)


HTH,
David


On Wed, Feb 10, 2010 at 10:40 AM, Michael Wild <themiwi at gmail.com> wrote:

>
> On 10. Feb, 2010, at 15:37 , Luigi Calori wrote:
>
> >
> > Hi Michael:
> >
> > They are more or less something like:
> >
> >
> > ExternalProject_Add(
> >   ${PACKAGE}
> >   SOURCE_DIR ${BASE_SOURCE}/${PACKAGE}/src
> >   BINARY_DIR ${BASE_BUILD}/${PACKAGE}/build
> >   INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
>
> I don't think this is correct! The INSTALL_DIR should be IMHO in the
> build-tree. Otherwise the files will be installed into the system while
> building (which, apart from being very bad practice, might fail if the user
> doesn't have the rights to write in this location).
>
> >   URL http://www.zlib.net/zlib-1.2.3.tar.gz
> >   PATCH_COMMAND ${CMAKE_COMMAND} -E copy
> "${Package_Dir}/Patch/CMakeLists.txt" <SOURCE_DIR>/CMakeLists.txt
> >   CMAKE_COMMAND ${CMAKE_COMMAND}
> >   CMAKE_ARGS
> >       ${Package_std_cmake_args}
> > )
> >
> >
> > The problem is that I do not know how to easily issue a re-build without
> a re-download:
> > The steps are always done, even if there is something broken in the
> configure or build step, so if I just clean the whole project, the download
> happen again, even if the (patched)source dir is already there.
>
> Does it also happen if you just re-build without the clean step? Probably
> the stamp files get removed by the clean... Usually it should not be
> necessary to do a "clean" when developing.
>
> >
> > I am working in MSVC9, from the master project, a download is re-issued
> even whn I switch from debug to release (i think because stamp file are
> config dependent)
>
> Hmm. Haven't tried using a multi-config IDE so far. Are the stamp-files in
> a configuration-specific subdirectory? What's the value of BASE_SOURCE?
>
> >
> > Thanks in advance.
> >
> > Luigi
> >
> >
> > Michael Wild wrote:
> >> On 10. Feb, 2010, at 14:57 , Luigi Calori wrote:
> >>
> >>
> >>> I' m trying to develop a project for building several lib dependencies
> using ExternalProjectAdd
> >>>
> >>> Is there a way to avoid re-download of upstream tar.gz while developing
> config flags?
> >>>
> >>> ANY examples of ExternalProjectAdd would REALLY welcome
> >>>
> >>> Thanks in advance.
> >>>
> >>> Luigi
> >>>
> >>
> >> That's strange, this doesn't happen in my projects...
> >>
> >> Can you show an example of your ExternalProject_Add calls?
> >>
> >> Michael
> >>
> >>
> >
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100210/710c7afb/attachment-0001.htm>


More information about the CMake mailing list