[CMake] How to handle git branches

Michael Wild themiwi at gmail.com
Tue May 18 14:59:50 EDT 2010


On 18. May, 2010, at 20:52 , Andreas Pakulat wrote:

> Hi,
> 
> 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).
> 
> Andreas

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. To get around this I use ccache for large projects. For smaller stuff, I just don't care. For the most popular branches I usually keep separate build trees around, though, because quite often I want to use different flags and options.

Michael



More information about the CMake mailing list