[CMake] in- and out-of-source tree builds

Filipe Sousa natros at gmail.com
Wed Mar 14 16:44:18 EST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Orion Poplawski wrote:
> Various projects using cmake state that they don't support in source 
> tree builds.  Is this a general case for cmake projects?
> 
> We're working on packaging guidelines for cmake projects in Fedora. 
> Draft is here: http://fedoraproject.org/wiki/PackagingDrafts/cmake. 
> Currently this does an in source tree build.
> 
> I currently do:
> 
> mkdir fedora
> pushd fedora
> cmake ..

this is out source build because CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR
are not the same

> In which the build directory is a subdirectory of the source tree.  I've 
> also seen recommendations for a parallel directory, e.g.:
> 
> cmake ../source
> 
> Is this preferred over the former?

this depends on what you are trying to do, but for packing both should
be fine.

> What are the issues that arise?  In general with RPM packaging you are 
> starting with a clean freshly unpacked source tree.
> 
> Thanks!
> 

the best practice is to always use out source builds because it's what
most of us do and it's cleaner.

in my own projects i have two directories, one ~/projects with the
source code and the other ~/build with the compiled code. with this
layout i could have ~/build/foo/debug ~/build/foo/release
~/build/foo/debug-icc. i can remove the ~/build dir to free disk space.

- ---
filipe sousa

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF+GyybQdNYqwwwCwRAtZTAKCz4+tUO8q9dk11/WVmNGQI1V0A1ACfSoCt
aJ5bdf8GzkLfgZ7pVbtonI0=
=y8Ah
-----END PGP SIGNATURE-----


More information about the CMake mailing list