[CMake] Control Object code destination?

Alexander Neundorf a.neundorf-work at gmx.net
Fri Apr 25 14:43:22 EDT 2008


On Friday 25 April 2008, Eric Torstenson wrote:
> So, I take it that this isn't possible? Is there a way to make a feature
> request?
>
> It seems to me to be a very important thing to do when developing
> applications on multiple
> platforms, which cmake is intended for.
>
> What would be nice is a variable that can be set which would allow the
> developer to tweak or
> completely override the object code path. This would allow me to use the
> same sources to
> compile for linux 32 bit. Linux 64 bit. Mac OS X and windows as well as
> release/debug versions of
> each. While it might seem goofy, it saves on compile time when making
> changes for platform A
> and checking that they don't break B,C,D. Keeping your sources in
> separate folders will work,
> but keeping them up to date can be a pain. RSync and other things can
> work, but can also be
> a point of error if you forget to sync up or whatever.
>
> Another option would be to allow something like configure, where you
> allow the user to specify
> where the script is run (such as cd build-dbg; ../configure) I tried
> doing this, but it didn't have
> any effect on the make scripts and object code paths.

This is called out-of-source builds with cmake and is actually the preferred 
way how to build with cmake. You have to create separate builddirs for all 
different builds you want to do, and run cmake from these directories and 
point them to the source directory, e.g.

$ cd myfoo-build-release
$ cmake ~/src/myfoo/
...

There must be no in-source build in the source directory, i.e. no 
CMakeCache.txt may exist there, otherwise cmake will generate the buildfiles 
for this existing CMakeCache.txt.

Alex


More information about the CMake mailing list