Hi,
We have a global template for conan projects, defining options. One project now needs additional options. Is it possible to add an additional option during a method like configure_options?
Conan version: 1.4.x
Thanks, Claas
To help us debug your issue please explain:
I guess you are subclassing the four ConanFile class with s custom template class.
You could just do something like:
options.update({"tests": [True, False]})
default_options = default_options + ("tests=True",)
Hi,
If it is subclassing, yes, what @danimtb suggested can work, because it is normal python evaluation (the inheritance is evaluated before conan converts those things to conan objects). If not, please ellaborate a bit further in which way you are using that global template. Many thanks!
Hi,
Your assumptions are true :-)
I ended up with the following code (requires python 3.5+):
class MyPackageconan(ConanTemplate):
options = {**ConanTemplate.options, **{'extraOption': [True, False] }}
default_options = ConanTemplate.default_options + ("extraOption=True",)
The suggestion with update did not work on class attributes.
Most helpful comment
Hi,
Your assumptions are true :-)
I ended up with the following code (requires python 3.5+):
The suggestion with update did not work on class attributes.