SuperBuild: git clone gets deleted when recreating build dir

Alexander Neundorf neundorf at
Thu Sep 15 11:20:45 UTC 2011

On Tuesday, September 13, 2011 01:54:38 PM Valentin Rusu wrote:
> On 09/12/2011 11:08 PM, Alexander Neundorf wrote:
> > On Sunday, August 28, 2011 09:33:01 PM Valentin Rusu wrote:
> >> Hello,
> >> 
> >> In my setup, the sources are cloned outside the ../build/ directory, as
> >> that
> >> let me easily find and modify them. But I just found out that the source
> >> directory gets deleted when I recreate the corresponding build
> >> directory.
> >> 
> >> To make it clear, here are the steps:
> >> 1- go to one of the superbuild subdirs,
> >> 2- mkdir build
> >> 3- cd build
> >> 4- cmake ..
> >> 5- make
> >> This will clone the sources in the src directory then build them. On my
> >> setup, the src directory is outside this build directory.
> >> 
> >> 
> >> Now, if the build directory created at step 2 is deleted (rm -rf build),
> >> then steps 2 to 5 are re-executed, the src located directory will get
> >> recreated at step 5 and all local modifications will be lost.
> >> 
> >> I looked into the cmake externalproject_add macro documentation, but it
> >> says
> >> nothing about this. What would be the option that we must use to prevent
> >> git clone if existing sources are in place?
> > 
> > I think nothing.
> > The source dir is part of the build dir.
> Well, that's the default setting. But I tried using superbuild to build
> sources I work on.

You can just work on the sources as they have been checked out via superbuild.
You can also ignore the toplevel superbuild-source and build dirs later on and 
just work with the individual checked out and configured repositories.

Or do you mean you want to use superbuild to build git repositories which it 
hasn't checked out itself ?
This is not and probably also won't be supported.
But, as written above, you can do it the other way, use superbuild to get 
everything, and ignore it later on.

> So I adjusted the configuration to get the sources
> outside of this directory, in a common source dir. This also has the
> advantage to let me see what are the repos I got from GIT.
> > Why do you want to delete it
> > completely ?
> In some cases like recompiling QT a complete rebuild is needed.

You can delete the whole Build/ directory inside the super-build meta-build 

> > It should be enough to delete only the "Build" dir in the build
> > dir (and not the "Source" dir which is with the default setup its
> > sibling).
> > 
> > So, for a superbuild, the building is the whole process, i.e. getting the
> > sources, configuring, and updating them.
> Is superbuild intended for those who want to contribute to KDE or it's
> only packager-oriented? Should developers stick with kde-srcbuild or
> techbase scripts?

It should be fine for developers.

> > By deleting the build dir of this super- or meta-build, all steps have to
> > be redone, including getting the sources.
> > I'll have a closer look again in the next days.
> Could you also check the updating operation please, as it's currently
> using "git fetch" instead of "git pull". E.g., if the build dir is not
> deleted and the clone is already there, newer sources are never
> retrieved inside the clone.

Please report that one to cmake directly.
superbuilds use the ExternalProject.cmake from CMake, and this one does all 
the actual work, including getting the sources etc.


More information about the Kde-buildsystem mailing list