[CMake] $ENV usage and documentation

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Jan 27 20:34:22 EST 2008


I would like to be able to read arbitrary environment variables from within
cmake.  The 2.4.8 documentation only refers to $ENV once as "$ENV{PATH}" in
an extremely narrow context (the TO_CMAKE_PATH signature of the FILE command).
However, when I tried, e.g.,

SET(pc_path "$ENV{PKG_CONFIG_PATH}")

it seemed to work.  Is this usage supported in general?

The current documentation has a number of different references to ENV.
It refers to

$ENV{PATH}

one place (in a narrow context as noted above),

ENV var

several places, but in extremely specific contexts (which I presume could be
replaced by $ENV{var})

and

ENV{PATH}

in one place (an example showing how to use SET to write
the PATH environment variable).

Please document $ENV for reading and ENV for writing arbitrary environment
variables in at least the CVS version.  A logical place for this general
documentation might be the SET command since as noted above that already
gives an example for writing the PATH environment variable.

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 libLASi project (unifont.org/lasi); 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