-
Notifications
You must be signed in to change notification settings - Fork 376
Updated reuse_cmake_install with an example of package() #750
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
Updated reuse_cmake_install with an example of package() #750
Conversation
Hi @mristin, thanks a lot for this PR! Could you please check the CLA sign? We need it to get this PR accepted. Regarding the changes in this PR, one of the things that made us not kind of recommend this usage is because package() method would be called twice in case you define no_copy_source = True. Also, as conanfile methods are executed independently, you have to create a new CMake object in package() and configure same definitions, for example: https://github.com/bincrafters/conan-mbedtls/blob/414f0a54ba604f5fcd56b85a03874b717ae5036b/conanfile.py#L54 So finally I would say it is a trade-off. And I'd say that if we are going to make this change, it will be better to include the whole solution as in the example linked above. |
@danimtb thank you for the review! Please apologize for somewhat amateurish pull requests -- I'm new to conan and we have just started to use it in the company.
After reading the docs you pointed me to I'm a bit puzzled why the
Could you please have a look at the commit 0675a46 and let me know if that is what you had in mind or something more complex? |
Hi @mristin, Don't worry, every PR (especially to the docs) is always welcomed and we really appreciate the feedback from users. Regarding to the commit you pointed: yes, that is exactly what I was trying to highlight. For the case of
Now, if you set
So in the case you were using |
@danimtb thanks for your explanation! I'm still a bit puzzled about this step:
Why would you call the same function twice that doesn't include any parameter to change its behavior? I looked into: def package(self):
""" package the needed files from source and build folders.
E.g. self.copy("*.h", src="src/includes", dst="includes")
"""
self.output.warn("This conanfile has no package step") so there seems to be no side effects. Are there parameters I'm not aware of (like (After some discussion in the office) The way I understand CMake is that |
Hi @danimtb, |
Hi @mristin, As I told you before (sorry about the mistake):
Currently I thinks the best would be to make the changes you are suggesting in this PR (cmake.install() in package()) and include a warning message regarding |
Hi @danimtb , I also added a more verbose paragraph on I removed the example that leverages internal conan API. |
Thanks for the re-work @mristin! |
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.
There are a couple of minor issues that could be improved, @danimtb could you please have a look?
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.definitions["SOME_DEFINITION"] = "On" |
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.
I think this cmake.definitions
should be before cmake.configure()
, otherwise it is ignored.
automatically extract the information of the necessary libraries, defines and flags for different | ||
build configurations from the cmake install. | ||
def package_info(self): | ||
self.cpp_info.includedirs = ['include'] |
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.
These are the defaults, it is not necessary to define them, and it might be confusing to do so, without a clear warning or something.
@memsharded done! https://docs.conan.io/en/latest/howtos/cmake_install.html
|
This update is related to the issue #716 .