Closed leviskim17 closed 2 months ago
Hi @leviskim17
Thanks for your question.
After downloading the zlib library through NuGet in Conan,
Sorry, it is not very clear what you are trying to achieve. Why would you download it from Nuget?
Some important notes:
source()
method must be invariant. It should always download exactly the same sources, but this is not what you are doing. Conditionals in source()
are explicitly forbidden, access to settings/options will fail, but you are avoiding that unpexectedly using self.info
in a place that can be broken for some cases like the local flow.self.src_url = urllib.parse.urljoin(baseUrl, data["Windows"]["inc"])
in the recipe, so even if the setting -s os=Linux
it will still download the Windows binary, not the Linux one. I would suggest just building from source the combinations that you need, it is going to be much faster and simpler than trying to fetch them as pre-built from other place.
If you still need to go this way, I'd suggest to just do the downloads in the build()
method as explained in the docs: https://docs.conan.io/2/tutorial/creating_packages/other_types_of_packages/package_prebuilt_binaries.html#downloading-and-packaging-pre-built-binaries. Do everything in the build()
method, do not use source()
or layout()
for any of this logic.
@memsharded Thanks for your comment. I think it was the issue of CMake of libpng. Maybe.
It is the compony policy to use prebuilt libraries through nuget. So I have implemented to use nuget from the company Artifactory.
After chaning of package_info to
self.cpp_info.set_property("cmake_find_mode", "both") # Enable both module and config mode
self.cpp_info.set_property("cmake_file_name", "ZLIB") # Set CMake file name
self.cpp_info.set_property("cmake_target_name", "ZLIB::ZLIB") # Set CMake target name
From lowercase to uppercase, it is working.
Thanks for your helps.
It is the compony policy to use prebuilt libraries through nuget. So I have implemented to use nuget from the company Artifactory.
Conan integrates the full lifecycle of creating the packages from source and managing the binaries with less effort than having to have a separate build process that uploads the binaries to nuget first. Specially, when those libraries start to have their own dependencies (zlib is easy, as it doesn't have dependencies) then the process gets more and more complicated if having to download dependencies (via Conan?) build the binary, upload the binary to nuget, then have another recipe that downloads the binary from nuget? That would be terribly complicated for something that Conan can manage very easily. While I understand that there might be company policies, I suggest to propose simplifying that process when it starts getting complicated, you will waste more time, effort and money to make it work. And Conan packages are stored in Artifactory as well, it is not that they are not traceable and manageable.
From lowercase to uppercase, it is working.
Ok, so I guess the main issue is solved then? May we close the ticket as resolved? Thanks.
Hi @leviskim17
Any further question or issue here? Can we close the ticket? Thanks for your feedback.
Thanks so much for your support!
What is your question?
conanfile - libpng.txt conandata.yml-libpng.txt conanfile - zlib.txt conandata.yml-zlib.txt
conan version: 2.2.3
Situation After downloading the zlib library through NuGet in Conan, I encountered an issue where CMake could not find zlib when building the libpng package in Conan
Attempts Made
Are there any further steps required, beyond the attached conanfile, to ensure the usage of the zlib package downloaded from NuGet? Any advice would be greatly appreciated.
Have you read the CONTRIBUTING guide?