How can I generate pkg-config files for my package?
I have a Catkin package that generates several binaries and libraries, but unlike some other packages, pkg-config can't find them.
ROS seems to have set the path to both my Kinetic installation, as well as my workspace.
echo $PKG_CONFIG_PATH
somelocation/workspace/devel/lib/pkgconfig:somelocation/ros_catkin_ws/install_isolated/lib/pkgconfig
When I ask pkg-config --list-all
about it, it does know about all of the ROS libraries, and also about things I installed in my own workspace, like joy
and uuid
. But it does not find the libraries I wrote myself.
I went over to the CMakeLists.txt
of joy
to see if I could find anything obvious that has to be done to generate the correct files, but can't see anything. There is no .pc
file in the repo either. I also tried to google around, but all results are about using external packages inside ROS, not about using ROS package outside it.
Currently I'm just doing this, but that apparently does not get you any pkg-config
files.
Full source: https://github.com/RoboTeamTwente/rob...
add_library(Skill
$<TARGET_OBJECTS:treegen>
$<TARGET_OBJECTS:tactics>
$<TARGET_OBJECTS:utils>
$<TARGET_OBJECTS:skills>
$<TARGET_OBJECTS:conditions>
)
add_dependencies(Skill
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)
When I run this, there is no output
$ pkg-config --list-all | grep -i skill
So what is the correct way to tell pkg-config
about my library, just like joy
and uuid
?
This should be done automatically for your package, but it will depend on you properly setting up (and ordering) your
CMakeLists.txt
. Please add that to your question so we can take a look.I've added a link to the source code: https://github.com/RoboTeamTwente/rob... I'm trying to link the Skill library that I added.
That's quite a long
CMakeLists.txt
. I don't have time to check it all now, so I'll point you to wiki/catkin/CMakeLists.txt. The ordering and contents of statements on that page should give you some things to check.Suggestion: try to create an MWE and see if that works with
pkg-config
(it should). Then do a diff (could be a mental one) between your MWE and yourroboteam_tactics
package.Btw: this is no longer used by anything. It's something that the
rosbuild
system relied upon. Unless you have some custom tools that use it, it can probably be removed.Ah! Catkin makes a
pkg-config
entry for the wholeroboteam_tactics
, rather than any individual libraries I define. If I addSkill
tocatkin_package()
, I can dopkg-config --libs roboteam_tactics -Lsomewhere/lib -lroboteam_tactics_analysis -lSkill
. Is there a way to have skill on its own?The pkg config file is generated for the entire CMake project, in this case for your ROS package. I don't believe it's possible to generate a config file for each separate target, no.
Ok. Thanks!