I have create a conan package for my libraries and noticed that I need to duplicate requires
list for the library and for the package recipe. I wonder if there is a better way of doing it.
I am building conan packages for exising libraries. Say I have libA and libB - which depends on libA. That is in order to build libB I need libA built and 'installed'. So I have crafter conan package for libA which is build and installed as it has no other dependenices. I now can build libB with conan by specifiing in conanfile.txt that libB depends on libA.
But when I am developing a package for libB I have to duplicate a list of dependencies of libB in requires
property in conanfile.py
.
cat libB/conanfile.txt
[requires]
libA/1@user/stable
...
cat conan-libsB/conanfile.py
...
class LibBConan(ConanFile):
...
requires = "libA/1@user/stable"
...
def build(self):
cmake = CMake(self, parallel=True)
cmake.configure(source_folder=self.name)
cmake.build()
cmake.test()
cmake.install()
The above is a simplified version from the real library https://github.com/abbyssoul/conan-libstyxe/blob/master/conanfile.py and https://github.com/abbyssoul/libstyxe/blob/master/conanfile.txt
Is it possible for conan to figure out that if the source package contains conanfile.[txt|py]
then this defines requires
field.
In case that a tool is required fist to source a package build_requires
should be used.