[CMake] Specifying out of source build directory from command line

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Oct 26 11:08:46 EDT 2006


On 2006-10-26 09:40+0200 Eric Noulard wrote:

> 2006/10/26, Martin Lütken <mlu at danware.dk>:
>> 
>> 
>> How can I specify the build directory from the cmake command line client?
>> I can do it from within the GUI, but have not been able to get cmake to
>> create it's "make-files"
>> in other directories than the default, which is at the source root.
>
> In fact the DEFAULT directory, AFAIK, is not source root
> but the working dir where you have launch cmake.
>
> 1) If it's your first build
>
>   mkdir my_build_dir
>   cd my_build_dir
>
>   cmake /path/to/source_dir
>
>    make
>
> 2) if you have already run cmake in "my_build_dir"
>
>    cd my_build_dir
>    cmake .

Note, if you have a dirty source tree (that is one where you have invoked
cmake from within the source tree using, e.g., "cd /path/to/source_dir;
cmake .") you will run into trouble, see 
http://www.cmake.org/Wiki/CMake_FAQ#I_run_an_out-of-source_build_but_CMake_generates_in-source_anyway._Why.3F
To avoid this issue start with a clean source tree (i.e., freshly unpacked
from the tarball or freshly checked out from CVS) and never invoke cmake
from within that tree.

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