conan icon indicating copy to clipboard operation
conan copied to clipboard

[question] How to use conanfile.py to specify the path for full_deploy,

Open wizard-123 opened this issue 6 months ago • 4 comments

What is your question?

How to use conanfile.py to specify the path for full_deploy, and make the paths in the generated conan_toolchain relative? Using 'Conan install . -d full_deployer --deployer-folder conan_deps' generates an absolute path for the libraries in the conan_toolchain.

Have you read the CONTRIBUTING guide?

  • [ ] I've read the CONTRIBUTING guide

wizard-123 avatar Jul 07 '25 07:07 wizard-123

Hi @wizard-123

Thanks for your question.

The deployers are not something that are specific of conanfile.py. A deployer is something that can be applied to any conanfile, including dependencies, you can do something like conan install --requires=somepkg/version --requires=otherpkg/otherversion --deployer=full_deploy, and it will install those packages and their transitive dependencies. As you can see with this command line, it is impossible to have a conanfile.py to define such a deployment path.

What you are asking about conan_toolchain.cmake, is not very clear, I am not sure what you mean. The deployment is for final extraction of compiled binaries to be used outside of Conan, not to be used by the conan_toolchain.cmake. Such Conan toolchain knows how to use the dependencies without deploying them. Deployers are when you want to get the final package binaries, for example to distribute your final product to your end customer in a zipped folder, a Windows msi installer or a Debian .deb package. But not to be used by a Conan toolchain.

Finally, recall, that deployers are intended to be user-customizable. If you want, you can implement your own deployer easily, and then manage it with conan config install/install-pkg. If you need some deployer to do something different to what the built-in deployers do, this is the recommended way.

memsharded avatar Jul 07 '25 08:07 memsharded

The conan install command installs packages along with their transitive dependencies, specifically expecting prebuilt binary packages. It does not handle packages created using conan export that only contain source and header files unless those are explicitly marked as header-only or no-build in the recipe.

I'm raising this point because I have a package created using conan export that only includes source and header files (no build step). However, when I run conan install, it fails with a "missing binary package" error. This suggests that conan install is intended for retrieving fully packaged folders—typically with compiled binaries—while in my case, only the exported sources are present.

Vaibhav13032000 avatar Aug 04 '25 14:08 Vaibhav13032000

@Vaibhav13032000 this is because even if a package only exports sources, you still need to create the package in the Conan cache, and for this you'll need to call conan create. Even if it does not have a build step, you still need to implement the necessary copy from your self.source_folder to the self.package_folder recipe in your package() method, as documented in the Conan tutorial

Please let me know if this helps :)

AbrilRBS avatar Aug 04 '25 23:08 AbrilRBS

Any further question or comment here? Thanks for the feedback.

memsharded avatar Dec 02 '25 10:12 memsharded