[build2] Access to environment variables

Karen Arutyunov karen at codesynthesis.com
Fri Sep 1 12:10:39 UTC 2017


Hi Max,

> ...Unfortunately only for one directory. 

We have implemented $regex.split() function for splitting string into 
list using regular expression.

So now if OPT environment variable contains space-separated quoted 
options ("-Ic:/dir1" "-IC:/dir2" ...), you can write something like this:

config.c.poptions = $regex.split($getenv(OPT), ' *"([^"]*)" *', '\1')

As a result config.c.poptions variable will contain a list of unquoted 
options.

Currently build2 documentation is sparse, so the only place you can find 
function descriptions is build2 source code. Documentation for 
$regex.split() is located in build2/functions-regex.cxx (line 448).

You can obtain the latest toolchain from 
https://stage.build2.org/0/0.7.0-a.0/

Karen



More information about the users mailing list