[cmake-developers] ExternalProject update target dependencies

David Cole dlrdave at aol.com
Thu Oct 24 17:01:29 EDT 2013


> If I add 2 external projects (A and B), with B DEPENDS=A, and
> STEP_TARGETS=update, I expect to be able to update B without updating,
> building and installing A, since just updating the code is obviously 
not
> dependent.

> I tried to look at ExternalProject.cmake, and the code seems to handle
> this exactly as I expect, setting the dependency only for the 
configure
> command.

...

> Any idea about the reason why this happens and how to fix this?


The target level dependency expressed by B DEPENDS=A, in the context of 
CMake's ExternalProject, means that all steps of A must run before any 
step of B is run. When you add step-targets to B, each step-target also 
depends on A at a target level, which means that all steps of A will 
run before any of the steps of B, even if you only request to build a 
single step of B.

This is by design, and should NOT be "fixed"... :-)

I will frequently separate an ExternalProject into 2, one for 
downloading (and/or patching/updating), and then another that depends 
on that one for configure/build/install. That way, with many such pairs 
of ExternalProject, all the downloading/patching/updating of everything 
may happen in parallel, and then the real activity takes place after 
that. Additionally, all the download/patch/update projects have no 
dependencies, and updating just one will not cause anything else to 
happen.

So, although I wouldn't recommend changing ExternalProject for this, 
you could fairly easily change your use of it to something like this 
set of projects:

  download-A
  download-B
  A DEPENDS download-A
  B DEPENDS download-B A

If you did it like that, adding step targets to the download projects 
would not affect anything else.


HTH,
David




More information about the cmake-developers mailing list