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

How do I get rosmake to call cmake

asked 2011-03-20 23:13:12 -0500

Benoit Larochelle gravatar image

updated 2011-03-22 05:08:12 -0500

Here's a minimal example. ROS Package A depends on ROS Package B. The authors of these packages did not distribute Makefiles, because they contain hard-coded paths to their computers. Therefore, I need to call cmake . and then make.

I would like to to call rosmake A and have it call cmake on both A and B and then make. Is that possible?

Currently, it just skips over any package without a Makefile:

[rosmake-0] Starting >>> A [ make ]
[rosmake-0] Finished <<< A  No Makefile in package A

I do not want to copy their code into a new package, because I would need to do that every time that the authors publish a new version.

In addition, when I create my ROS Package C, which depends on A, I don't want the users of my package to have problems compiling, because they are not necessarily familiar with ROS. I want them to type rosmake C and have everything working as expected.

edit retag flag offensive close merge delete


I updated the question to make it clearer, because I still don't have an answer
Benoit Larochelle gravatar image Benoit Larochelle  ( 2011-03-27 19:18:33 -0500 )edit

5 Answers

Sort by ยป oldest newest most voted

answered 2011-04-04 20:14:41 -0500

tfoote gravatar image

updated 2011-04-07 09:24:50 -0500

When wrapping 3rd party packages you need to write a custom Makefile for that package which will download and build the 3rd party package. An example of calling cmake is the kdl package. A slightly simpler example is bfl.

If you want other packages to build first you must add dependencies on that package. And export required compile and link flags. I highly recommend you go through the Beginner Tutorials which covers how to create and use ROS packages.

edit flag offensive delete link more

answered 2011-04-05 21:44:30 -0500

Benoit Larochelle gravatar image

I still have not found how to get rosmake to call cmake, but copying a Makefile from a dummy package created with roscreate-pkg solves part of the problem. In fact, it's not even necessary to call roscreate-pkg because the Makefile has only this line:

include $(shell rospack find mk)/

With this Makefile in the package directly (not in the src folder), I can call make and rosmake and it always works. Unfortunately, it does not solve the problem of other packages (dependencies) not having Makefiles.

edit flag offensive delete link more

answered 2011-03-22 04:37:07 -0500

dornhege gravatar image

Are you talking about ROS packages or external packages?

For ROS packages the best way would be to add them as a dependency and use the standard (ROS) Makefile.

For external packages rosdep should be the way to go.

edit flag offensive delete link more

answered 2011-04-06 00:11:16 -0500

dornhege gravatar image

First: roscreate-pkg does a bit more than create the Makefile. It will also produce manifest.xml mainpage.dox, a dummy CMakeLists.txt, etc.

For your question: Could you say what exactly you mean with "other packages"?

Is this other ROS packages? They should always have a ros like Makefile (or ROS_NOBUILD) and adding them to manifest.xml as a dependency is the right way to go.

Is this an external (= non-ROS) package? Then use the way tfoote described.

edit flag offensive delete link more

answered 2011-03-21 03:48:49 -0500

joq gravatar image

updated 2011-03-22 03:44:56 -0500

The roscreate-pkg script will generate the CMakeLists.txt and Makefile that rosmake requires.

See: roscreate.

Since your package already exists, the simplest approach may be to create a new dummy package, then copy those two files to yours. They are small and simple. You'll need to edit CMakeLists.txt, but the Makefile should work unmodified.

edit flag offensive delete link more

Question Tools



Asked: 2011-03-20 23:13:12 -0500

Seen: 1,378 times

Last updated: Apr 07 '11