[CMake] [VS gen] Multiple configurations code

Andreas Pakulat apaku at gmx.de
Mon Jul 26 16:42:01 EDT 2010


On 26.07.10 22:24:11, Olaf van der Spek wrote:
> On Mon, Jul 26, 2010 at 10:12 PM, David Cole <david.cole at kitware.com> wrote:
> >> Is there a problem with multiple configures / build trees?
> >
> > No, not at all. We do this all the time. But again, I thought from your
> > questions that you were trying to do it all in one build tree.
> 
> I'm not familiar with the term build tree.

That seems to be your problem here. The so-called "source tree" is the
project folder on your disk containing the actual source files and the
CMakeLists.txt files. The build-tree on the other hand is the folder in
which you run cmake to generate the build files (Makefiles or whatever).

> Let's describe what I'd like:
> I've got a single CMakeLists.txt for a lib named "xbt". I've got xbt.h
> and xbt.cpp. I'm using VS (2010).
> With a few simple commands, I should be able to build and package all
> possible configurations of this lib.
> In the ideal case, this would be cmake ., nmake ... or similar.

The usual way with Makefiles is to:

<setup tools for x64/release>
mkdir x64_release
cd x64_release
cmake ..
nmake
<setup tools for x64/debug>
mkdir x64_debug
cd x64_debug
cmake ..
nmake
<setup tools for x86/debug>
mkdir x86_debug
cd x86_debug
cmake ..
nmake

So the various build-tree's for the configurations are separate subdirs
inside your source-tree (you can also put them completely outside of
your source-tree). So there's only 1 set of source/cmake files, but
multiple sets of makefiles/buildfiles. 

Andreas

-- 
Someone whom you reject today, will reject you tomorrow.


More information about the CMake mailing list