[cmake-developers] ExternalProject + git submodule sync

Ben Boeckel ben.boeckel at kitware.com
Tue Mar 29 10:50:42 EDT 2016


On Tue, Mar 29, 2016 at 10:24:26 -0400, Brad King wrote:
> Might a user want to change the url used locally?  If so then we
> need a way to turn off the automatic sync, though I think making
> it default is reasonable.

I suppose it is possible, but if you're modifying submodules behind
ExternalProject's back, you already have issues:

  - it fails to detect updates[1] not done by ExternalProject itself, so
    "edit in source tree then run `make $external_project` at the
    top-level" is already a non-working workflow (submodules or no);
  - if it isn't using the name of a *local* branch, when ExternalProject
    runs its update step, it will leave your work behind (if it is
    committed);
  - if you have modifications in a submodule, the stash commands don't
    work properly (they never unapply properly and I think the only
    fool-proof way to fix it is something like:
        git submodule foreach --recursive cmake -P do_stash_if_necessary.cmake
        cmake -P update.cmake
        git submodule foreach --recursive cmake -P undo_stash_if_stashed_above.cmake).

So if we add support for skipping this step, it's probably more
reasonable to put a flag around having ExternalProject do *any* update
step (available for any non-tarball source really).

--Ben

[1]Though to do this properly, we need to add a dependency on every file
under the source tree.


More information about the cmake-developers mailing list