-
Notifications
You must be signed in to change notification settings - Fork 989
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] CMake generators: Move includes of build_modules
after targets are created in generated CMake find modules
#7261
Comments
cc @GordonJess |
Hi! Is there any real use-case for this? For example, the target alias, IMO it is not something to be packaged with the library, it is something that belongs to the consumer |
I guess my main thinking is, if there is no great reason not to do it, and it offers some flexibility for people wanting to use build modules, then why not? As for real use cases, my own is of course to create alias targets so I can name the CMake targets used by consumers of my own Conan packages anyway I want. I know upcoming features like this one could make that unnecessary, but it seemed worthwhile to make an issue to tackle the problem from this angle as well, especially since it appears so unintrusive to Conan itself. I know @gordonjess mentioned wanting to set a custom property on the target, so maybe he could comment here too. |
I've just realized that this issue was here and I opened another one: #7352 I'm copying here what I've written in the other one after talking with the team and I'll close that one:
|
build_modules
to after targets are created in generated CMake find modulesbuild_modules
after targets are created in generated CMake find modules
IIRC I struggled with the current behaviour too with either protobuf or grpc 👍 |
The attribute
self.cpp_info.build_modules
can be used to set CMake files which get included in the generated find modules created bycmake_find_package
.Today, these
include
statements are put before the targets which are defined by the generated find module files, rather than at the end of the file, which means the build modules script cannot interact with the exported targets directly.@danimtb has suggested there may not have been a motivation in putting the build modules before the target, so if the is the case let's move them to the end of the file.
This would enable things like setting additional properties on the targets or creating clones or aliases of them.
The text was updated successfully, but these errors were encountered: