I would like to be able to access the value of a variable which is computed inside a jamroot (or jamfile) from the shell.
Something like this for CMake.
Example jamroot:
MY_VARIABLE=42
Desired solution:
b2 --print-variable=MY_VARIABLE # running in a directory below the jamroot
I did not find a satisfactory solution.
First hackish solution: requires to modify the
jamrootby adding at the end (i.e. after variable is set):
then run b2 with the environment variable set:
B2_DISPLAY_VARIABLE_AND_EXIT=MY_VARIABLE b2Second hackish solution: requires to generate a custom file below the
jamrootcustom.jam(generate it using the shell):then run b2 with:
b2 -sJAMFILE=custom.jamand thenrm custom.jamJAMFILEis a special variable which for some reason is not mentioned in the new doc.Remark
These solutions do not work if the variable is set from a
jamfile. It may be possible to adapt the first solution using a custom target that would be called on thejamfile.