Ask Your Question
2

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
2

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

William gravatar image

updated 2016-05-03 15:03:15 -0500

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

https://github.com/catkin/catkin_tool...

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 CMakeListst.txt you can set options and then include the plain cmake package with add_subdirectory ( https://cmake.org/cmake/help/v3.0/com... ).

Hopefully one of these options works for you.

edit flag offensive delete link more

Comments

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 imageJohn 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 https://cmake.org/cmake/help/v2.8.11/...

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 967 times

Last updated: May 03 '16