jam

How to pass command line arguments in Jamfile?


I want to execute a certain command g++ <some cpp file> in a Jamfile. However, I want to take the name of the file as command line input. In bash, this can be done as follows

File temp.sh -

#!/bin/bash

g++ $1

And invoking it as bash temp.sh <cpp file>

I want to do the similar using jam by invoking jam -fJamfile <cpp file> on the terminal. How to do it? I tried searching for it but did not find any related information anywhere.


Solution

  • Found an answer.

    Say the variable declared inside the jamfile is $(cppFile), run the jam as

    cppFile=<cpp file required> jam -fJamfile