conan icon indicating copy to clipboard operation
conan copied to clipboard

[question] How to override an option with value `None` via cmdline

Open DenizThatMenace opened this issue 5 months ago • 1 comments

What is your question?

The documentation of Conan explains that recipe options can take different pre-defined values, one of them being None. Consider for example:

options = {
    "shared": [True, False],
    "threading": [None, "OMP", "TBB"],
 }
default_options = {
    "shared": True,
    "threading": "OMP",
 }

The documentation further explains how to override a recipe's option default-value with another value from the command-line.

conan create . -o:a "*:shared=False" -o:a "*:threading=TBB"

However, I am now struggling.
I see no way, how I could set an option to its allowed value of None.


1st attempt:

conan create . -o:a "*:threading=None"

yields the following error:

ERROR: 'None' is not a valid 'options.threading' value.
Possible values are [None, 'OMP', 'TBB']

2nd attempt:

conan create . -o:a "*:threading="

yields this error:

ERROR: '' is not a valid 'options.threading' value.
Possible values are [None, 'OMP', 'TBB']

3rd attempt:

conan create . -o:a "*:threading=\"\""

yields this error:

ERROR: '""' is not a valid 'options.threading' value.
Possible values are [None, 'OMP', 'TBB']

Is this at all possible?

Is that maybe a bug and the parsed string should be compared against the string "None" and if equal be replaced by None instead?

Have you read the CONTRIBUTING guide?

  • [X] I've read the CONTRIBUTING guide

DenizThatMenace avatar Aug 28 '24 08:08 DenizThatMenace