ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Do plain cmake packages need to handle pkg-config file generation?

asked 2013-04-26 08:34:40 -0500

updated 2013-04-27 04:56:30 -0500

@joq and I are working on improving the current libsegwayrmp release from @William.

It seems like the current release does not generate a pkg-config file. Consequently, any dependency on this package fails. On the other hand, the libfreenect release works fine, as pkg-config file generation was already handled upstream. This worked out of the box while building the package with catkin_make_isolated.

Should I setup libsegwayrmp to do something similar? Or is there an alternative I am not aware about?


Edit #1

Based on @William's answer, here's a second question. Can a rosbuild package depend on a plain-cmake package? If yes, then can it use find_package or only pkg-config is supported? This is the error I get trying to build segway_rmpX (currently dry) with the current libsegwayrmp wet release.

Failed to invoke /opt/ros/groovy/bin/rospack cflags-only-I;--deps-only segway_rmpX
Package libsegwayrmp was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsegwayrmp.pc'
to the PKG_CONFIG_PATH environment variable
edit retag flag offensive close merge delete


I am pretty sure they do. Most Linux libraries already have that implemented.

joq gravatar image joq  ( 2013-04-26 15:53:17 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-26 21:24:10 -0500

William gravatar image

updated 2013-04-29 06:54:05 -0500

libsegwayrmp is not a catkin package. Therefore it does not require a pkg-config. There are find_package files provided by libsegwayrmp for depending projects to find and use it:

find_package(libsegwayrmp REQUIRED)




target_link_libraries(my_executable ${libsegwayrmp_LIBRARIES})

You can see the (simplistic) implementation file here:

That being said it would be nice to have pkg-config files for libsegwayrmp.


Yes, a rosbuild package can depend on a plain CMake project. You just have to treat libsegwayrmp like you would any other third party library (Boost, Eigen, VTK). You should not list libsegwayrmp as a ros package dependency, but rather as a rosdep dependency.


However, to remain backwards compatible (preventing a need to change segway_rmpx) would be to add pkg-config files to libsegwayrmp. I forgot until now that REP-0136 has a note about this:

edit flag offensive delete link more


Does that only work when the library is installed into /usr or /usr/local?

joq gravatar image joq  ( 2013-04-27 03:04:16 -0500 )edit

@William: Thanks for your answer. I have added a second question to the original one. Either way, we were planning on catkinizing everything so it does not matter if segway_rmpX is using rosbuild for the moment.

piyushk gravatar image piyushk  ( 2013-04-27 04:58:06 -0500 )edit

@William: Thanks! This gives us all the information we need to proceed.

piyushk gravatar image piyushk  ( 2013-04-29 09:20:03 -0500 )edit

Question Tools


Asked: 2013-04-26 08:34:40 -0500

Seen: 1,604 times

Last updated: Apr 29 '13