[CMake] ctest & git submodules

Brad King brad.king at kitware.com
Tue Feb 26 16:50:05 EST 2013


On 2/26/2013 2:52 PM, Jean-Christophe Fillion-Robin wrote:
> +1 to add these into CTest :) What would be the argument against it ?

Not every project wants every submodule checked out all the time.
A major use case for them is to have an umbrella project with many
submodules and the developer may only checkout and work on some.
Some may even be proprietary and inaccessible to some machines.

>     > However, it seems to me that ctest already does a
>     > git submodule update --recurse

This is the proper command to update everything that is already
to configured to checkout in the source tree.

>     > but its missing the --init flag to deal with changes to the
>     > .gitmodules file.
>     It also misses git submodule sync to deal with changes in git
>     submodule URL,

These are all intentionally missing for the above reason.  We
should honor the user's configuration.  Maybe they intentionally
use a custom url for a submodule for the branch they test.  We
should not blow away their configuration by default.

> and reset --hard etc.

We do a reset --hard at the top level but I do not think we
do it in the submodules.  That may be worth adding, perhaps
with git submodule foreach.

>     We have just been dealing with a
>     few of these issues and currently call git directly to sync, init, and
>     then use submodule foreach to reset and clean all submodules before
>     updating.

That is the expected way to deal with it.  The local dashboard
script knows if it needs to preserve the user config or not.

We could also consider adding options for ctest_update to
tell it to init, sync, etc., but it should not be the default.

-Brad


More information about the CMake mailing list