DrP3pp3r
DrP3pp3r

Reputation: 857

Scons: command-line build variables without restrictions on allowed values

Used Scons version: 3.0.1 (for historic reasons)

I want to add a command-line build variable in my Scons script which is not limited by which values it expects. Both EnumVariable and ListVariable require you to provide a list of allowed values or elements. I want a variable that (just like a C++ define can be passed to g++ via -Dfoo=bar (or at least -Dfoo_bar) ) can be passed to the Scons script.

Anything like

scons my_define=foo_bar

or

scons my_define=foo=bar,gnarl=argl

or

scons my_define=foo my_define=bar

would work.

I did not find anything like that in the user guide or searching via Google.

Is this possible? If yes, how?

Upvotes: 0

Views: 115

Answers (1)

bdbaddog
bdbaddog

Reputation: 3511

Yes. It's in the users guide at

https://scons.org/doc/production/HTML/scons-user.html#idp140637539360912

While there are validated variable types provided by the various vars.Add*() methods. You can have a non-validated variable by just using plain vars.Add()

Here's an example from the manpage.

vars.Add('CC', help='The C compiler')

Upvotes: 1

Related Questions