-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] How to set options with hyphens in conanfile.py? #3768
Comments
Hi @gouriano Can you please clarify the Conan version you are using? Also, please note that setting options in recipes is not the most recommended approach, but setting them in profile files, and having recipes to check them in |
$ conan version |
I think this is mostly an overlook of the recipe, using hyphens that if is is true that it is not strictly forbidden, it is inconvenient for this use case. I'd say that you can do something like |
It works! Thank you! |
Thanks for the feedback. The truth is that this sounds a bit as a workaround, but it is also true that there is a loophole there, as hyphens are not forbidden. But forbidding them now wouldn't be great, as that would mean breaking recipes in ConanCenter, or at the very least having some painful upgrades that would be also painful for users of those recipes. As the general recommendation is to define options values in profiles, not in recipes, I think it might be better to leave it as-is. Please read https://docs.conan.io/2/knowledge/faq.html#defining-options-for-dependencies-in-conanfile-py-recipes-doesn-t-work, and try to define your options in profiles as much as possible (and let recipes I'll move it to the docs repo to try to add a note there about this. |
What is your question?
Hi
I am trying to customize aws-sdk-cpp package in my conanfile.py. The problem is that it uses hyphens in option names
See the recipe
My conanfile looks as follows:
If I use "self.options["aws-sdk-cpp/"].text-to-speech = False", I get wrong python
If I use "self.options["aws-sdk-cpp/"].text_to_speech = False", Conan2 does not complain, but the setting does not seem to have any effect (I know this because my app still requires pulseaudio package)
If I use "default_options = {"aws-sdk-cpp*:text-to-speech": False}", everything seems to work fine.
My question: is it possible to specify an option with hyphen in configure() method?
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: