-
Notifications
You must be signed in to change notification settings - Fork 993
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] visible=True for tool requires seems not to work correctly #16058
Comments
Hi @maitrey Thanks for your question.
I'd like to challenge this idea. The There might be other approaches to align the version easily, for example using a version range like this in all the recipes: def build_requirements(self):
self.tool_requires("ctool/[>=3.0 <4]@autosar/release") will automatically align the versions to the same and latest one within the range. I will have a look to your report, but as a starting point, I'd probably discourage making tool-requires |
It works if I set this : https://docs.conan.io/2/reference/tools/cmake/cmakedeps.html#build-context-build-modules for ctool. |
Yes, this is the gap I am having a look to, it is not expected that tool_requires are propagated transitively and also used with the visible=True for Even if I am having a look and trying to improve it, I'd still recommend thinking my comment above, using |
Any other alternative as this tool is common for all the packages and must be set with visible=True so that any other versions fail to build the dependents. |
Yes, this case is recommended to do with:
In your profile file, this is a better alternative in most senses:
|
will tool_requires / build_requires factor into the binary-hash? I'm just asking under the scenario that I have a code generator for multiple packages and they all need to have the same version because the generated code might not be compatible if different generators are used. If I'm consuming those packages as binaries and tool_requires / build_requires is not factored into the id, they might not align - or am I seeing something wrong? In this case I would have to use a "normal" / library require? |
Yes, if you enable it in the appropriate config or in the package:
The factoring into the consumers |
Even if I set this in profiles, and if developer configures any higher version in his recipe then he will still be allowed to use the higher version? Right? I have not yet tested your suggestion but before that asking. |
No, the profile is the most "downstream" user definition, and as such it always have precedence. Whatever you type in your profiles or command line will have precedence over recipe-defined things. It will be very weird to do The strategy for this is recipes won't define the tool-requires at all, but use it from the profiles. Users that want to use a different version of the tool, can override their profile or append an extra profile. Or even use the per-package syntax But in any case, what you are asking about recipes being able to define their own version conflicts with the initial approach you were trying. If you make the tool_requires |
This is being marked for closing with the fix in #16077. Still, marking the |
Thanks @memsharded . I will need to test it and provide feedback with profiles. Many thanks for your suggestion. |
One question somehow the last suggestion introduces a hen and egg problem.. If I have to release ctool and I have conan-config with profiles , if there is any change in profiles there will be a problem what to release first ctool or conan-config. Isnot it? |
It depends if the profiles do require a different
Because one thing is that it is not recommended at all for your problem, and another different thing is that it fails that way, that it shouldn't even if users make it |
What is your question?
Hi!
I have a package A that is dependent on package B. Both must use same version of tool X and I set the visible attribute to True.
recipe for B:
Example for recipe a:
CMakeLists for pkga has:
find_package(b config REQUIRED)
pkg a fails with :
-- Conan: Target declared 'pkgb::pkgb'
CMake Error at C:/ProgramFiles/CMake/share/cmake-3.26/Modules/CMakeFindDependencyMacro.cmake:76 (find_package):
Could not find a package configuration file provided by "ctool" with any
of the following names:
Add the installation prefix of "ctool" to CMAKE_PREFIX_PATH or set
"ctool_DIR" to a directory containing one of the above files. If "ctool"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
kdp/build/Release/generators/pkgb-config.cmake:24 (find_dependency)
_src/CMakeLists.txt:6 (find_package)
What I donot understand why is it looking for ctool in find_package (b CONFIG REQUIRED)
Am I not using the visible attribute in the correct way?
Could you please help me?
Thanks!
Br,
Maitrey
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: