I am developing two libraries A and B with B depending on A, both managed in their own Git repositories. The libraries are built with CMake and installed in standard UNIX directories. During installation a .pc file is also installed that is used by pkg-config. Library B uses pkg-config to find library A, therefore it is necessary that either library A is installed system-wide with make install or the PKG_CONFIG_PATH is set to the appropriate directory.
Now, I use Jenkins to build library A on a remote machine. Unfortunately, library B cannot be built because the dependency is not met (pkg-config cannot find library A). Setting the paths in a pre-build step is not working because the commands are run in its own shell.
The questions are
- Can I somehow
make installlibrary A? Or, - can I somehow point CMake to
/var/lib/jenkins/jobs/libA/install_dir/lib? - Is there a better way to build projects with inter-dependent libraries?
Using artifacts, as suggested by user1013341, is one of the steps that was needed to this problem. But to get it working with
pkg-configwe have to do a little bit more:CMakeLists.txtto produce a tarball withmake package_source..pcfile pointing to the install location of library A.PKG_CONFIG_PATHand theLD_LIBRARY_PATHto the untarred library A.