conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
7.95k stars 951 forks source link

[question] Setting tool configuration values in build/generate/configure method for the package that is being created #16525

Open CommanderCRM opened 1 week ago

CommanderCRM commented 1 week ago

What is your question?

According to this page, conf_info is used only for consumers and consumers use it in generate(). What if someone wants to set tool configuration to be used during the package build process, for example tools.build:verbosity to verbose? Is there any way to do this?

Have you read the CONTRIBUTING guide?

franramirez688 commented 6 days ago

HI @CommanderCRM

I don't know if I completely understood your question. When you want to set any configuration, you should use your Conan profile or even the CLI:

your_profile

[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=15
os=Macos

[conf]
tools.build:verbosity="verbose"

Or through the CLI:

conan create . -c "tools.build:verbosity='verbose'"

As you said, conf_info is only used by consumers and only set by tool_requires, so it's quite a specific and limited way to do it. I would recommend using the profile or the CLI to set any conf variable

CommanderCRM commented 5 days ago

I think we understood each other. So there's no way to do this inside recipe of the package being created, only inside profiles or through CLI? For example, there was a verbosity flag in Conan 1 for MSBuild, which is now only present in conf

franramirez688 commented 4 days ago

Yeah, those parameters are not available for the new tools, but you can also add the extra verbose parameter to each command which is the easiest way to get it:

For instance:

conan create . -vvv

Copying and pasting from the Conan command docs:

  -v [V]                Level of detail of the output. Valid options from less
                        verbose to more verbose: -vquiet, -verror, -vwarning,
                        -vnotice, -vstatus, -v or -vverbose, -vv or -vdebug,
                        -vvv or -vtrace
CommanderCRM commented 4 days ago

so this flag will affect build tools as well?