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

Building a Pure CMake project with Catkin

asked 2016-05-03 14:18:26 -0500

John Hoare gravatar image

We want to build a pure CMake project in our catkin workspace, but we want it to be built with non default options.

Are there examples on how to do this or best practices to do this?

At first, I was imagining that you could add the CMake arguments to the package.xml that needs to be created for the package, but this doesn't look to be the case. Is there an example on how to do this, documentation seems to really be lacking for using catkin with pure cmake projects beyond stating that it is supported.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-03 15:02:11 -0500

William gravatar image

updated 2020-02-26 12:52:32 -0500

lucasw gravatar image

There is no support for this (passing arguments to exactly one package), but it has been discussed before:

There's even a proposal of how to do it. But no one has had time to implement it.

Short of implementing that feature (which would be appreciated :D), you might be able to work around the issue by passing the build options to all packages (using the --cmake-args option which is available in all the tools). So long as the options are fairly specific to your plain CMake package, then the other packages should ignore it (they will complain about being given an option that doesn't affect them). This isn't a great solution but it would work for most cases. The other option is to put your plain CMake package in a subfolder, then put the package.xml and another CMakeLists.txt in the folder above. Then in that CMakeLists.txt you can set options and then include the plain cmake package with add_subdirectory(

Hopefully one of these options works for you.

edit flag offensive delete link more


Thanks. We are going the route of placing the actual CMake project in a subdirectory. We will look at teaching catkin proper support possibly in the future.

John Hoare gravatar image John Hoare  ( 2016-05-04 08:47:52 -0500 )edit

I think the best way to do what we want is to be able to provide your own pre-cache file specified in the package.xml

John Hoare gravatar image John Hoare  ( 2016-05-04 08:48:02 -0500 )edit

Question Tools



Asked: 2016-05-03 14:18:26 -0500

Seen: 1,891 times

Last updated: Feb 26 '20