diff --git a/v2/doc/src/faq.xml b/v2/doc/src/faq.xml index 5d7c5a1ca..1ef16e498 100644 --- a/v2/doc/src/faq.xml +++ b/v2/doc/src/faq.xml @@ -1,6 +1,6 @@ - - + + Frequently Asked Questions @@ -78,5 +78,41 @@ exe a : a_obj ; + +
+ + Accessing environment variables + + + + Many users would like to use environment variables in Jamfiles, for + example, to control location of external libraries. In many cases you + better declare those external libraries in the site-config.jam file, as + documented in the recipes + section. However, if the users already have the environment variables set + up, it's not convenient to ask them to set up site-config.jam files as + well, and using environment variables might be reasonable. + + + In Boost.Build V2, each Jamfile is a separate namespace, and the + variables defined in environment is imported into the global + namespace. Therefore, to access environment variable from Jamfile, you'd + need the following code: + +import modules ; +local path = [ modules.peek : SOME_LIBRARY_PATH ] ; +exe a : a.cpp : <include>$(SOME_LIBRARY_PATH) ; + + +
+
+ \ No newline at end of file