Skip to content

How to translate makefile to b2 jamfile conditional #203

Answered by grisumbras
fasxmut asked this question in Q&A
Discussion options

You must be logged in to vote

Returning to your original question, if you do need something like that you can go the most primitive route and add a similar construct to project-config.jam:

import os ;
local ABC = [ os.environ ABC ] ;
if $(ABC) {
    ABC = <cxxflags>-XYZ ;
}
# project-config is a parent of root project and its properties are applied to it
project :  default-build $(ABC) ;

With a POSIX shell this can be used as

ABC=1 b2

You can also pass that value via a b2 CLI flag (or support both):

import os ;
ABC ?= [ os.environ ABC ] ; # only replaces the variable's value if it's empty
if $(ABC) {
    ABC = <cxxflags>-XYZ ;
}
project :  default-build $(ABC) ;

And invoke b2 like this:

b2 -s ABC=1

And you can go fa…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@fasxmut
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@fasxmut
Comment options

Answer selected by fasxmut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants