Skip to content
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] query source of setting/option value #8565

Open
Johnnyxy opened this issue Feb 26, 2021 · 1 comment
Open

[question] query source of setting/option value #8565

Johnnyxy opened this issue Feb 26, 2021 · 1 comment

Comments

@Johnnyxy
Copy link

Johnnyxy commented Feb 26, 2021

Hi there,
is it possible to determine the source of a specific recipe option or setting.
My library uses Boost. And the user can specifiy through profiles/commandline that Boost is used as header-only or linked as binary (e.g. -o boost:header_only=True).

My library preferres to use Boost as header_only. As the library can be compiled for several targets. Those targets can be quite old where boost:header_only is not possible and Boost has to be linked through binaries.

Normally the boost:header_only option is not set explicitly. In this case I want to be able to set the boost:header_only based on the employed compiler.

Question

How can I detect where the value of a specific option has been set?

  • default value
  • profile
  • command line
  • ...

At the moment it would suffice if I could determine if the value has been set by the user or if it is the default value.
Comparing the current value to the default value is insufficient as the user could specify a value which is the same as the default value.

Best regards

@solvingj
Copy link
Contributor

solvingj commented Mar 2, 2021

It's a valid question, and in general it comes up occasionally for many people debugging packages.

I can definitely say that there's currently no way to "query" this information in the way you are asking. I also worth pointing out that the process for evaluating an option's value is pretty involved, because every recipe in the graph has the opportunity to change the value of an option in it's own configure and/or config_options, and the final value can depend on the order the dependencies are evaluated.

So, with that said, I can see two possibilities:

  1. Experiment with logging the value of the options using hooks (either to stdout or to file)
    • Sadly, I don't see a post_configure or post_config_options, but perhaps post_package_info might do it, not sure.
    • Maybe this turns into a feature request for a post_configure hook, which could be used for this purpose
  2. Potentially this could become a feature request to simply add additional logging to the current Conan evaluation of settings and option, enabled under the configuration item conan_logging_level=info, or perhaps a new dedicated configuration item conan_log_options.

Either way it's probably a feature request, so ping @memsharded to see if either of those ideas sounds reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants