[CMake] Source file symlinks on out-of-source builds

Bill Hoffman bill.hoffman at kitware.com
Thu Dec 3 13:42:26 EST 2009


Rodolfo Schulz de Lima wrote:
> On Thu, Dec 03, 2009 at 12:41:59PM -0500, Bill Hoffman wrote:
>> Tools like emacs and other build tools can be taught how to deal with
>> the sources not being right there.   The symlinks will likely be a pain
>> to maintain.   What happens when a file is removed in the source tree?
>> Who updates the symlinks?  I guess every time CMake is run it could
>> remove them all, and recreate them.  Or it could just collect dead
>> links...  It sounds kind of complicated.
> 
> Well, CMake already does some complicated tricks (that's a compliment!).
> I've made a talk about CMake yesterday to an audience of computer graphics
> researchers and when I presented the notion of 'out-of-source builds' I
> saw some blank stares when I said the source files just wouldn't be there
> where the Makefile is (that's what they are used to).
> 
And, they can still have that, but I once they get used to it, I bet 
they will like it...
> About emacs/vi, they can locate the source file only if we're going
> though an error list, as gcc spits out the path to the source files
> involved. But if you want to load another file, you must do it yourself,
> which can be irritating sometimes.
> 
There are emacs things you can do so that M-x compile in the Source tree 
will automatically cd to the build directory and do the build.  Then you 
can stay in the source tree for edits and builds.   Another option might 
be a tool on top of CMake.  I think there is something that will create 
sym-link trees.  Then you can just do an in-source build in the sym-link 
tree version.

-Bill


More information about the CMake mailing list