[Cmake] Out of Source Builds

Andy Preston andy at prestonmedina.com
Tue, 30 Dec 2003 18:08:59 +0000 (GMT)


I'm trying to setup a project under Linux right now and have a problem
that doesn't make much sense to me. What I'm trying to do is setup Debug
and Release builds of my library. I have a top level subdirectory for my
library which has a CMakeLists.txt that simply does

PROJECT(aps)
SUBDIRS(Release Debug)

I then have three subdirectories, src, Debug and Release. The src
directory has a CMakeLists.txt that correctly sets up the library. Thats
working fine.

If I go into the Debug/Release directory and do "cmake ../src", then go
back up into the main library directory "make clean/all" works as
expected. If I then touch the main CMakeLists.txt, and then run make, it
rebuilds the Makefiles, include the Debug/Release ones. The Debug/Release
Makefiles have their SOURCE_DIR set their directory(Debug/Release) instead
of the src directory. If I then rerun "cmake ../src" then all is well.

Do I need a CMakeLists.txt in the Debug/Release directories to point the
source back to the src directory ?

Also how will this setup of Debug/Release translate into a VC6/7 project ?
Previous to using CMake, I was using SlickEdit to generate my Makefiles.
This setup the Makefile to take a CFG=Debug/Release argument with the
appropriate code in the Makefile to switch. This is the same method used
by VC6 generated makefiles.

thanks,

Andy