-
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
'cmake' generator use the package name for target 'CONAN_PKG::' #6288
'cmake' generator use the package name for target 'CONAN_PKG::' #6288
Conversation
…me>' instead of 'cpp_info.name'
I've added here (#6292) a PR to |
conans/model/build_info.py
Outdated
def get_name(self, generator): | ||
return self.names.get(generator, self.name) | ||
def get_name(self, generator, pkg_name=None): | ||
fallback_name = self.name if generator not in ["cmake", "cmake_multi"] else pkg_name # FIXME: Remove in v1.22 (https://github.com/conan-io/conan/issues/6269#issuecomment-570182130) |
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.
This should mimic the behavior that will be implemented by conan-center-index when recipes are fixed, so it should affect probably cmake_paths
generator too.
1228ccb
to
830b76e
Compare
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.
Check comment, change something if necessary or leave, and merge. Thanks.
self.assertNotIn("my_pkg", content["conanbuildinfo_multi.cmake"]) | ||
self.assertNotIn("MY_PKG", content["conanbuildinfo_multi.cmake"]) | ||
self.assertIn('add_library(CONAN_PKG::MyPkG INTERFACE IMPORTED)', | ||
self.assertNotIn("mypkg", content["conanbuildinfo_multi.cmake"]) |
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.
It is obvious that these don't exist in content, as the package name is my_pkg. I am not sure what this assert is checking.
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.
Totally true, the one that could appear is MyPkG
(the cpp_info.name
). Changed it, after CI runs, I'll merge it.
…:' (conan-io#6288)" This reverts commit 1bdbf18.
Changelog: Fix: Generators
cmake
andcmake_multi
use the name of the package instead ofcpp_info.name
(this change is to be reverted in 1.22)Docs: omit
closes #6269
This PR is a patch to keep previous behavior (and future one) related to the name used by the generators. In this PR the
cmake
generator will use the value incpp_info.names["cmake"]
or the package name (it won't usecpp_info.name
). With this workaround we don't need to change any recipe inconan-center-index
right now to match the desired behavior, we can wait until Conan v1.22.Read the rationale in this comment: #6269 (comment)