[build2] Access to environment variables

Moldmann Max (DC-MH/ENG52-NA) Max.Moldmann at boschrexroth-us.com
Fri Sep 1 15:46:27 UTC 2017

Awesome! That works!


-----Original Message-----
From: Karen Arutyunov [mailto:karen at codesynthesis.com] 
Sent: Friday, September 1, 2017 8:11 AM
To: Moldmann Max (DC-MH/ENG52-NA) <Max.Moldmann at boschrexroth-us.com>; users at build2.org; Boris Kolpackov <boris at codesynthesis.com>
Subject: Re: [build2] Access to environment variables

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/


More information about the users mailing list