[cmake-developers] git branches and cmake build trees
themiwi at gmail.com
Fri Apr 9 15:46:39 EDT 2010
On 9. Apr, 2010, at 21:30 , Alexander Neundorf wrote:
> what is a good way to handle git branches and cmake build trees ?
> With cvs/svn, I check out the branches I want into different source
> directories, and then create build directories. Each build directory is tied
> to a source directory, which is via CVS/svn tied to a branch.
> How do I handle this with git ?
> If I understand correctly, the idea with git is to have 1 cloned repository
> locally, and then create all the branches I need in this repository, and then
> switch between the branches while staying in the same source directory and
> just use git to switch the branch.
> But this means that if I want build trees for different branches, then they
> all refer to the same source directory ? And I have to take care manually
> that my (one) source directory is in the right branch currently ?
> To have multiple source directories, I need multiple clones, right ?
> Does this mean I have to clone the cmake repository once for each branch I
> want ?
> How do you handle this ?
I forgot to mention another alternative I sometimes use: A single clone and multiple binary trees in combination with ccache to speed up unnecessary rebuilds after switching the branch. Using a shell-prompt which indicates the current branch (and its state) can be very useful too (e.g. zsh with vcs_info). E.g, currently my CMake prompt inside my CMake source tree looks like this:
mwild at nynaeve ~/Projects/cmake [git:master] ▶
Where the triangle changes color depending on whether the working tree is clean, has modifications or changes in changes in the index. Very, very useful (although, for very large projects sometimes slow).
More information about the cmake-developers