conan-io / conan-io/docs

[question] How to set options with hyphens in conanfile.py?

Open
#3,768 5 comments 0 reactions 1 assignee Claimed by @memsharded View on GitHub
Dominant language
C++
Stars
125
Forks
382
Avg merge
22h 39m
Merged PRs (30d)
21

Description

### 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](https://github.com/conan-io/conan-center-index/blob/master/recipes/aws-sdk-cpp/all/conanfile.py)

My conanfile looks as follows:

from conan import ConanFile
class ConanApp(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps"
# default_options = {"aws-sdk-cpp*:text-to-speech": False}
def requirements(self):
self.requires("aws-sdk-cpp/1.9.234")
def configure(self):
self.options["aws-sdk-cpp/*"].text_to_speech = False

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?

- [X] I've read the CONTRIBUTING guide

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.