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

[bug] conan2 conanfile.txt options ignored for test_requires dependencies #14280

Closed
zabereer opened this issue Jul 12, 2023 · 3 comments · Fixed by #14340
Closed

[bug] conan2 conanfile.txt options ignored for test_requires dependencies #14280

zabereer opened this issue Jul 12, 2023 · 3 comments · Fixed by #14340
Assignees
Milestone

Comments

@zabereer
Copy link

Environment details

  • Operating System+version: RHEL 8.6
  • Compiler+version: gcc 11
  • Conan version: 2.0.7
  • Python version: 3.11.0

Steps to reproduce

  1. create new directory with conanfile.txt containing:
[test_requires]
benchmark/1.8.0
[options]
benchmark/*:enable_lto=True
  1. make sure no benchmark in local cache by conan remove --confirm benchmark
  2. from that directory run conan install .
  3. check cache what you got with conan list 'benchmark/*:*' and notice package options has enable_lto: False

That is surprising to me and not really what I want.
If I modify conanfile.txt to have [requires] instead of [test_requires] then I get an LTO benchmark.

(and before I forget, thank you for amazing work on conan2).

Logs

No response

@memsharded memsharded self-assigned this Jul 12, 2023
@memsharded memsharded added this to the 2.0.9 milestone Jul 12, 2023
@memsharded
Copy link
Member

Hi @zabereer

Thanks for your report.
We are aware that this won't work this way, and it is by design, for tool_requires.
But maybe for test_requires it should/can work. We need to check it, we will have a look, thanks for the details to reproduce.

In the meantime, you can do:

  • Define a conanfile.py instead of a txt
  • Define test_requires("benchmark/version", options={<key>: <value>})

That guarantees that the option is passed to the dependency.
You might also define it in the profile or in command line, and I think that should work too.

(and before I forget, thank you for amazing work on conan2).

Thanks very much! 🙂

@zabereer
Copy link
Author

Thank you @memsharded , I will use the workaround for now.

@memsharded
Copy link
Member

Fixed in #14340 for next 2.0.10

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

Successfully merging a pull request may close this issue.

2 participants