-
Notifications
You must be signed in to change notification settings - Fork 979
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
[feature] Generate cmake version files with different policies #13809
Comments
Thanks for your suggestion. If the find_package(oneTBB 2017...<2022 ) |
Hi @memsharded, Thanks for your answer, I really like Conan and want to continue this discussion understand why some (unclear for me) decisions are made in Conan.
Because original
It works only for cmake 3.19 or later (while Conan requires 3.15), while we require 3.13 (available out of the box in most of Linux OS distributions). I understand that the suggestion could be to increase minimum required version, but I suppose this is not what Conan should suggest to its users. My points are:
I like Conan, but what I really don't understand - why original cmake files generated during
As a Conan user / recipe developer I want to provide configure options, build and install steps for the product, but I don't want to rewrite the content of |
We have had this discussion tons of times. Basically:
|
Maybe it's good to take into account and incorporate user's feedback :)
How it's possible if those files are generated by cmake automatically? (I mean files with targets, the rest of the config file should be just
Conan recipes do this as well. I've tried to
Sorry, I was talking about ConanCenter specifically. What if I know that my cmake scripts are 100% compatible with Conan rules and find only Conan dependencies? or the package does not have dependencies at all like TBB? Can I use my config.cmake and .pc file in ConanCenter? while files for other build systems will be auto-generated
Is it possible to classify and document what information is required depending on Conan supported build systems? I still assume that other than cmake build systems don't require so much information, so:
|
Because they assume building from source mostly and generating the different configs together if necessary, but this doesn't work for a package manager that will have Debug and Release package managers. So the a given xxxConfig.cmake can only find 1 configuration either Release or Debug but never both, and that breaks multi-config users, which are a large number of users.
This is unrelated, the fact that recipes in ConanCenter do not always requires a
This is utopic. Sounds good, but in practice it doesn't work, because the resources are not infinite, the contributors efforts are not infinite, the CI is not infinite. So it is needed to focus on 1 solution that is general for all. The |
Thanks for your answers @memsharded Returning back to original topic about default version file generated by Conan. In this video I've seen that Conan 1.x mistakenly implied that
What if one day TBB version will 2022.x? And it's still compatible with 2021.x (in the same way as 2021 is compatible with 2017, 2018 etc). Yes, some products can be source compatible independently on their major versions, because major versions can be incremented because:
Do you think Conan needs to introduce new options which are provided by cmake? |
The problem here is the compounding complexity of every corner case to be managed in the Conan codebase and documentation that ultimately is a maintenance liability slowing down the team and the project.
The cost of implementing a definition for this is far from trivial, and the utility is limited to very few corner cases in practice. As everything in SW engineering it is a matter of tradeoffs. Having to implement, document, test and maintain such a feature for this edge case is a quite large effort, to avoid an extremely small fraction of users having to bump the version in their CMakeLists.txt (a 5 seconds thing) when they bump the version in their conanfile.py, when they want to use a new version of that specific library is released (and that often will require other changes too, even in the source code). |
Unfortunately, it does not work. 2021 version is ignored here The problem is in versions files generated by Conan - they don't support version ranges. See https://gitlab.kitware.com/cmake/cmake/-/issues/24581 |
This was implemented in #14176, it has been merged, so it will be in 2.0.8. Thanks! |
Hi @memsharded |
To be clear, only the policy has been implemented. Version ranges have not been implemented yet, let's see how it goes with the policies first. As like any other property, the package recipe can define its policy in: # policy in ["AnyNewerVersion", "SameMajorVersion", "SameMinorVersion", "ExactVersion"])
from conan import ConanFile
class Test(ConanFile):
def package_info(self):
self.cpp_info.set_property("cmake_config_version_compat", "{policy}") And consumers can override it in def generate(self):
deps = CMakeDeps(self)
deps.set_property("onetbb", "cmake_config_version_compat", ...)
deps.generate() Older Conan versions are not aware of this property, so they will still need to match the version in their CMakeLists.txt, as they had to do so far, nothing changes for them (but it won't break), and they need to update to the latest Conan to avoid having to match the version exactly. But they can perfectly use the new recipes, it won't break, as unknown properties are ignored. |
Thank you for this feature, I needed it for VTK. |
What is your suggestion?
Hi,
I'm working on migration our project to Conan dependencies and faced with the following issue:
but when we started to run cmake, it failed to find oneTBB, because 2017 != 2021 => version is not satisfied from Conan point of view.
What is recommendation here? Should Conan support different policies for version file generation (as cmake provides) or any other solution can be provided here?
I understand that I can try to search for 2021 version first, then try older ones, but it's a work around which I don't want to have in our product. My criteria of Conan success is that users should not rewrite their cmake scripts specifically because of the fact, that Conan ignores cmake generated files.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: