On 2007-01-30 21:23+0100 Peter Soetens wrote:

Quoting kitts <[EMAIL PROTECTED]>:
On Monday 29 Jan 2007 IST, Alan W. Irwin wrote:
BTW, my understanding of why variables set in subdirectories do not
propagate to parent directories is the CMake developers are using this
rule to (rightly) limit variable scope to make it more difficult to have
cross-directory bugs.

What is a cross-directory bug ?

If you limit scope, then you can have variables of the same name in
different directories not interfering with each other.


We are using ENV{MY_SOURCES_LIST} to do the trick. This bypasses the use of CMake variables:

in subdir:
SET( ENV{MY_SOURCES_LIST} "$ENV{MY_SOURCES_LIST} Src1.cpp Src2.cpp")

in main dir:
SET(ENV{MY_SOURCES_LIST} "")
ADD_SUBDIRECTORY( subdir )
SET(FINAL_SOURCES $ENV{MY_SOURCES_LIST})

Now my $100.000.000 question is: And how does this trigger the cross-directory bug ?

Not "the" cross-directory bug.  However, environment variables introduce the
possibility of cross-directory bugs. Since such variables have global scope
in every directory you will have to be extra careful to give unique names to
them.

Please send a cheque for $100.000.000.  :-)

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
__________________________
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to