We're using conan v1.59 in our project (forced to as that's client's setup). It's a project in C, the build tool is CMake. This project has several dependencies. We're utilizing conanfile.py for building and packaging artifacts.
Let's say, ch-common is a requirement for this project. It's mentioned in conanfile.py as follows:
def requirements(self):
...
self.requires("ch-common/0.0.10@x/y")
...
The development environment is Debian Linux. ch-common is downloaded and CMake can find it, code compiles properly. ch-common only has a header file cr_def.h.
The artifact of our project is a library. Internally the library uses an enum in cr_def.h. The users of our project (those who'll be calling various functions of the library) will also need the cr_def.h because in many APIs defined in the library the enum is used as parameter.
We have a package() in conanfile.py to package the artifacts:
def package(self):
cmake = CMake(self)
cmake.install()
self.copy("*.h", dst="include/project/", src="include/public/", keep_path=False)
We'd like to copy cr_def.h in the package() like others.
How can cr_def.h be referred in the package() without hardcoded fixed path? We don't want to do something like:
self.copy("cr_def.h",
dst="include/project/",
src=os.path.expanduser('~') + "/.conan/data/ch-common/0.0.10/x/y/package/<hash>/include/",
keep_path=False)
Is there any variable holding the package location? Is there any better way to copy cr_def.h?
We can't ask our library users to include ch-common in their project - that's a client requirement.