Collect licenses of dependencies¶
imports feature it is possible to collect the License files from all packages in the dependency graph. Please note that the licenses are artifacts that must exist in the binary packages to be collected, as different binary packages might have different licenses. E.g., a package creator might provide a different license for static or shared linkage, they could provide different “License” files if they want to.
Also, we will assume the convention that the package authors will provide a “License” (case not important) file at the root of their packages.
conanfile.txt we would use the following syntax:
[imports] ., license* -> ./licenses @ folder=True, ignore_case=True
conanfile.py we will use the
def imports(self): self.copy("license*", dst="licenses", folder=True, ignore_case=True)
In both cases, after
conan install, it will store all the found License files inside the local licenses folder, wich will contain one subfolder per dependency with the license file inside.