[CMake] out of source command line flag

Roman Shtylman shtylman at gmail.com
Sun Aug 9 15:39:07 EDT 2009


I have been meaning to try and create such a patch for a while. The
idea behind the patch is that you can specify the location of the out
of source build directory on the command line. By itself, this really
isn't all that useful save having to type mkdir 'some dir', cd 'some
dir', and 'cmake ..'

I think the use in this feature comes from being able to do something
like the following from WITHIN the source tree

$> cmake -B ./debug -DDebug=1 .
$> cmake -B ./release -DRelease=1 .

This will create directories 'debug' and 'release' in the source tree
where it will put all of the cmake cache files and whatnot from the
build. Each directory will then be using the appropriate things
triggered by having set the -D ... note... this is just a simple
example

I used the -B flag (as it was already there and I couldn't tell what
else it was currently doing) ... but pardon me if it actually had a
previous purpose.

This patch is not meat to be exhaustive (as I might have missed a
usage scenario with cache files or whatnot), but it does demonstrate
the capability I am looking for.

Feedback is welcome...or if you think this feature is utterly
worthless let me know :) I wanna hear why it can't work (don't just
say...well, you could have just made the directory and done all that
within it...yea...I know...but the point is that I didn't have to :) )

~Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake_outofsource.diff
Type: text/x-diff
Size: 2946 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090809/100e3faa/attachment-0001.diff>


More information about the CMake mailing list