[CMake] How to handle git branches

Andreas Pakulat apaku at gmx.de
Tue May 18 15:18:29 EDT 2010


On 18.05.10 20:59:50, Michael Wild wrote:
> On 18. May, 2010, at 20:52 , Andreas Pakulat wrote:
> > I've recently bumped into a few problems with my usage of cmake on a
> > git-hosted project and am wondering what others are doing in such cases.
> > 
> > The setup is as follows: The project's master branch has its dedicated
> > builddir. Now when working on a feature I create a branch from master,
> > but I re-use the buildsystem as maintaing n builddirs is a pita. 
> > 
> > This however brings problems with it as far as I can see, specifically
> > when switching back to master branch (for example to merge somebody
> > else's feature-branch and push it later on) as git resets the
> > modification times of files according to the branch. For make-based
> > systems that rely on those modification times this if of course
> > horrible, hence I ended up with various bogus build problems, ranging
> > from generated-source-files not being re-generated, strange compiler
> > errors to even linking errors because .o files weren't re-created.
> > 
> > So I'm wether anybody here has a good recipe how to handle this with the
> > cmake-generated makefiles? I'd like to avoid having separate builddirs
> > for each branch and just as well to do a full make clean each time the
> > branch is being changed (as that would mean exploding compile times).
> 
> I never had the problem of bogus builds, only that Make decided to
> re-compile a lot of stuff that didn't need to be rebuilt.

Well, I didn't further investigate, but I do know that the
modification-time of one of the files is older in my master branch than
in the feature branch. Hence upon checking out master the modification
time was "older" than the one of the .o file (a lot older) and hence
make didn't rebuild it. At the same time there is a binary
incompatibility between the two branches.

Andreas

-- 
That secret you've been guarding, isn't.


More information about the CMake mailing list