-
Notifications
You must be signed in to change notification settings - Fork 981
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
[RFC] Feature: add cpp_info.generators #6587
Conversation
With the amount of nesting needed it would make sense to start using dictionaries: self.cpp_info.generators["cmake_find_package"] = {
"name": "OpenSSL",
"targets": {
"OpenSSL::Crypto": { "libs": ["crypto"] },
"OpenSSL::SSL": { "libs": ["ssl"] }
}
} With the most recent Python version it should be possible to provide type hints to statically check the structure somehow. We also have hooks for that, so the structure checking could be done, but every generator would need to specify some structure format somehow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My most important comment here, is that this looks too specific. What we are considering now is the definition of abstract "components", that will map to targets under cmake generators, but to other things in other generators.
This doesn't look the best approach. If you want very specific build system information, you could be creating the find_xxx.cmake files directly and using them. They are only restricted in ConanCenter. But precisely this new feature in ConanCenter will be problematic, because it will degenerate to something that works under one build system with one specific generator, but will likely fail with the others, and there is practically nothing we can do to automate checking that, and that will impose too much load on the review process.
My quick feedback, lets wait what the rest thinks.
I want to point out that a Granted, adding cmake variables is generator specific.
A better syntax would help a lot, imho.
Creating
Isn't that the reason why we add As a side note, I want to point out that currently, the tests at CCI only test the cmake and cmake_find_package generator.
Thanks for the quick reply! |
954379a
to
958604c
Compare
I think we need a solution for this soon and therefore pragmatic, a ton of people having issues with libs like openssl, protoc, reproc etc because there are multiple targets in the repo. |
Changelog: Feature: add self.cpp_info.generators
Docs: https://github.com/conan-io/docs/pull/XXXX (not yet)
Fixes #6069
Fixes conan-io/conan-center-index#419
Addresses #6329
This pull requests add a
generators
attribute toself.cpp_info
in thepackage_info()
method.This allows to pass generator specific properties.
As a RFC, I have implemented adding targets.
This allows to create
OpenSSL:Crypto
andOpenSSL::SSL
targets as documented here.The syntax that I have implemented is:
conans/model/gen_info.py
,a good separation between model and client (generator) should be designed. There is already a loose connection, but I think that the
_CMakeFindPackageTarget
class that I created ingen_info.py
has a lot of shared code with_CppInfo
.NAME::NAME
and the specialized targets can be shared a bit more.self.cpp_info
.That's why I added a
ModificationTrackingList
. This object provides a default list and tracks modifications.Todo's:
refactor
add cmake_find_package_multi support
add cmake variables to cmake_find_package and cmake_find_package_multi
add pkg_config support
If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
I've read the Contributing guide.
I've followed the PEP8 style guides for Python code.
I've opened another PR in the Conan docs repo to the
develop
branch, documenting this one.