Issue
I'm using conan to build a handful of executable. Each executable requires a different set of libraries.
I'm building an installer and would like to find the runtime dependencies for each executable, copy them out of the .conan folder and into the staging area.
Is there a way to do that with conan?
For example, one of my executables requires libQt5Xml, which is distributed as an shared object (.so). The library is stored ~/.conan/data/qt/5.15.6///package/7b11ed4c9c45d7c7dde6e1a702e4fe4d3c4901c6/lib/libQt5Xml.so
It would be nice if I could:
- Somehow automatically generate the list of required libraries (name and version number)
- Somehow generate a list of paths to the files I need.
I guess I can parse the conanfile and use globs but I'm wandering if there is a better way?
Solution
There are a couple of different ways to collect information and copy files from dependencies:
- You can use the
generate()
method of a consumerconanfile.py
, and iterate viaself.dependencies
all the information, accessing thedep.package_folder
, ordep.cpp_info.bindir
, for example and do acopy()
- You can use a deployer, at the moment there are a couple of built-in deployers, but custom ones can be created too, for example check the custom runtime deployer here. Deployers can be applied to any
conan install
, so no need to repeat the samegenerate()
in all recipes that you want to use it.
Answered By - drodri Answer Checked By - Mildred Charles (WPSolving Admin)