[Cmake] Specifying build trees -- partial answer

Karr, David David . Karr at titan . com
Mon, 4 Aug 2003 18:18:10 -0400


To answer one of my own questions,=20

> In any case I'd prefer something more like a command-line
> option [...]
>=20
> Is there such a way to specify different build directories
> from a given source directory [...] ?

I found out that if I simply do this on the command line:

 % cd /path/to/the/binary/output/directory
 % cmake /path/to/the/source/directory

this will create a workspace that builds the output under
/path/to/the/binary/output/directory.  The workspace file
itself is in the output directory rather than the source
directory.  I see why this makes sense: it's a lot easier
to juggle multiple output directories by putting the same
named .dsw file in each one than by trying to do some
trick on a .dsw in the source directory.

What I am apparently NOT supposed to do is to put output
from two source directories into the same place, because
when I try this, CMake complains that the new source
CMakeLists.txt is not the same one that generated the=20
CMakeCache.txt in the output directory.  Again I can see
good reason of this, but it seems to make it awkward if not
impossible to make two workspaces that both deposit their
.exe files in the same "bin" directory, at least when=20
using this technique.

The obvious solution (which I'm currently following) is=20
to just combine all the sources into a single workspace. =20
It's just that when there are more than about 30 projects=20
in the workspace, it starts to get harder than it should=20
be to find the project that one wants to open, and I end
up wishing I could spin off the sources for one or more of
the executables into their own workspace without having to
redesign the directory structure where the libraries and
executables end up when they're built.

David