[CMake] A CMake language peculiarity I have just discovered

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Sep 17 11:31:43 EDT 2006


On 2006-09-17 10:40+0200 Alexander Neundorf wrote:

> All relative file- and pathnames are interpreted as relative to
CMAKE_CURRENT_SOURCE_DIR. This is what one would usually expect everywhere,
e.g. when adding source files, or include directories, etc. You would expect
that main.cpp means the main.cpp in your source directory. Maybe it would be
possible to add some special cases, so that e.g. for the FILE() commands and
for the second parameter of CONFIGURE_FILE() relative paths are interpreted
relative to CMAKE_CURRENT_BINBARY_DIR, but IMO this would be inconsistent.
So if you write something in the buildtree, always prefix it with
CMAKE_CURRENT_BINARY_DIR.

I like consistency so my point-of-view was all generated files should go
into CMAKE_CURRENT_BINARY_DIR by default since that is where many generated
files (e.g., executables, libraries) end up by default.  However, my rule
would make for some nasty backwards incompatibilities, and the rule you
quote above (relative pathnames ==> default of CMAKE_CURRENT_SOURCE_DIR)
apparently has already been implemented in a consistent way so I withdraw my
request.

Thanks for your explanation.

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