[CMake] ".." in CMAKE_BINARY_DIR breaks ADD_CUSTOM_COMMAND

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Mar 10 20:09:47 EST 2007


On 2007-03-11 00:36-0000 Trevor Kellaway wrote:

> Does anyone have any advice on building out of source, I see numerous
> references to this, but haven't stumbled across any examples,
> especially:
>
> 1) where should you place the top level CMakeList.txt? (one level above
> the project, or in it?)

At the top-level of the source tree.

> 2) how do you invoke CMake (do you pass arguments for the build types
> and output directory, do you prebuild a cache file?)

All the BINARY directories (e.g., CMAKE_BINARY_DIR, see
http://www.cmake.org/Wiki/CMake_Useful_Variables) are created automatically
depending on what directory you are in when you invoke cmake.  So you should
not need to reset these variables.  The normal method of an out-of-source
build is as follows:

Create a build directory, cd to it, and invoke cmake using the relative or
absolute path to the top level of the source tree.

To explicitly answer your above questions in order, you can pass an argument
(e.g., -DCMAKE_BUILD_TYPE=Debug) for the build type, no output directory is
required (its the one where you invoke cmake, see above), and it is not
necessary to prebuild the cache file.

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 CMake mailing list