[Discuss] A question for the gurus and a CMake followup

Alan W. Irwin irwin at beluga.phys.uvic.ca
Fri Mar 2 17:24:44 PST 2007


Hi Adam:

Glad you found CMake to be useful.

On 2007-03-02 16:20-0800 Adam Parkin wrote:

> One of the things I don't like about CMake is that it generates a fair bit of 
> clutter in every directory in your source tree.  [...]
> It would be nice to be able to execute a single command which deletes all 
> this extra clutter so that one can get back to a "clean" source tree.

I strongly advise you to use a separate build tree for just this reason.
Suppose your clean source tree is contained in the "source"
subdirectory within the current directory.  Then

rm -rf build_dir  #(remove the stale build tree from previous attempts in
                   # case you want an absolutely clean start.  This action
 		  # is equivalent to the autotools "make distclean".)

mkdir build_dir
cd build_dir
cmake ../source
make
make install
etc.

With this approach your source tree remains clean by default unless you
deliberately configure your CMake build system to write something back to
the source tree using, e.g., the CMAKE_SOURCE_DIR variable (see
http://www.cmake.org/Wiki/CMake_Useful_Variables for an explanation of
this variable and many other useful variables.)

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the Discuss mailing list