Skip to content
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

Merged
merged 5 commits into from Jan 8, 2020

Conversation

@jgsogo
Copy link
Member

jgsogo commented Jan 2, 2020

Changelog: Fix: Generators cmake and cmake_multi use the name of the package instead of cpp_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 in cpp_info.names["cmake"] or the package name (it won't use cpp_info.name). With this workaround we don't need to change any recipe in conan-center-index right now to match the desired behavior, we can wait until Conan v1.22.

Read the rationale in this comment: #6269 (comment)

@jgsogo jgsogo added this to the 1.21.1 milestone Jan 2, 2020
jgsogo added a commit to jgsogo/conan that referenced this pull request Jan 2, 2020
@jgsogo

This comment has been minimized.

Copy link
Member Author

jgsogo commented Jan 2, 2020

I've added here (#6292) a PR to develop to be sure that these changes are not deployed in v1.22 (I will forget about it)

@jgsogo jgsogo requested review from danimtb and memsharded Jan 2, 2020
@danimtb
danimtb approved these changes Jan 3, 2020
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)

This comment has been minimized.

Copy link
@memsharded

memsharded Jan 7, 2020

Member

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.

@jgsogo jgsogo force-pushed the jgsogo:fix/cmake-conan_pkg-name branch from 1228ccb to 830b76e Jan 7, 2020
@jgsogo jgsogo requested a review from memsharded Jan 7, 2020
Copy link
Member

memsharded left a comment

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"])

This comment has been minimized.

Copy link
@memsharded

memsharded Jan 7, 2020

Member

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.

This comment has been minimized.

Copy link
@jgsogo

jgsogo Jan 8, 2020

Author Member

Totally true, the one that could appear is MyPkG (the cpp_info.name). Changed it, after CI runs, I'll merge it.

@memsharded memsharded merged commit 1bdbf18 into conan-io:release/1.21.1 Jan 8, 2020
2 checks passed
2 checks passed
continuous-integration/jenkins/pr-head This commit looks good
Details
license/cla Contributor License Agreement is signed.
Details
@jgsogo jgsogo deleted the jgsogo:fix/cmake-conan_pkg-name branch Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.