listappendbjamboost-buildb2

Append to list in boost build/b2/bjam


I would like to know how one can append items to a list in boost build/b2/bjam.

I am sure this must be easy but the search engines do not provide a result. Also Ctrl+F in the documentation does not help!


Solution

  • The operator to use is += as in GNU Make.

    Example:

    MYLIST = a b ;
    MYLIST += c ;
    echo $(MYLIST) ;
    

    Shows: a b c

    And to concatenate lists:

    MYLIST = a b c ;
    OTHERLIST = dd ee ;
    MYLIST += $(OTHERLIST) ;
    echo $(MYLIST) ;
    import sequence ;
    echo length: [ sequence.length $(MYLIST) ] ;
    

    Shows: a b c dd ee length: 5

    More information can be found in the Variables section of the documentation.