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

Migrating from rosbuild to catkin: <export> <cpp> </export> equivalent

asked 2015-03-11 06:22:54 -0600

Huy Cong gravatar image

updated 2015-03-11 06:26:27 -0600

Hello everyone, I'm working on switching beetween rosbuild & catkin build system. In my old rosbuild package manifest.xml, there is this macro:

<export> <cpp lflags="{my_lflags}" cflags="{my_cflags}"/> </export>

which I don't know how to transfer to catkin. Some suggestions say that it must be done in CMakeLists.txt catkin_package() but there are no options for cflags and/or lflags.

Any help will be appreciated

Thank you,

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-03-11 06:49:22 -0600

dornhege gravatar image

catkin_package is correct, see

INCLUDE_DIRS take the role of cflags and LIBRARIES are like lflags, just that in both cases you don't specify explicit flags, but links the exported include directories and libraries to link.

edit flag offensive delete link more



Just to add to this: if you need to export actual C(XX)_FLAGS (so not just include paths), that should be done using the CFG_EXTRAS argument to catkin_package(..).

gvdhoorn gravatar image gvdhoorn  ( 2015-03-11 07:48:45 -0600 )edit

Yes thats exactly what I want to do. My flags to export is -std=c++0x. The CFG_EXTRAS is quite difficult to understand, so I have to create a .cmake file that has set (C(XX)_FLAGS ...) then export the whole script?

Huy Cong gravatar image Huy Cong  ( 2015-03-11 08:14:53 -0600 )edit

Yes. You create a your_pkg-extras.cmake in a cmake/ subdir, then add the CFG_EXTRAS to your catkin_package(..) line. For setting CXX_FLAGS I'd use set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x"), as you want to append, not overwrite.

gvdhoorn gravatar image gvdhoorn  ( 2015-03-11 08:17:42 -0600 )edit

I tried catkin_package(.. CFG_EXTRAS {my_cmake} but {my_cmake} file was not build into devel/{my_package}/cmake/{my_package} directory, what has gone wrong? should I replace the name of the cmake file?

Huy Cong gravatar image Huy Cong  ( 2015-03-11 10:33:44 -0600 )edit

Adding a single option to the CXX_FLAGS does not really require using a templated extras file. Just make it a regular -extras.cmake, without the Also: as far as I know, the extras file doesn't end up in devel. Only in install.

gvdhoorn gravatar image gvdhoorn  ( 2015-03-11 10:52:46 -0600 )edit

Its ok to use -extras.cmake , but I want my file to end up in devel , so other package can see and include it also, is there a way to do it?

Huy Cong gravatar image Huy Cong  ( 2015-03-11 10:57:05 -0600 )edit

so other package can see and include it also

You don't need to include it in other pkgs. catkin takes care of that. It's all auto-magic.

gvdhoorn gravatar image gvdhoorn  ( 2015-03-11 11:03:18 -0600 )edit

Question Tools

1 follower


Asked: 2015-03-11 06:22:54 -0600

Seen: 186 times

Last updated: Mar 11 '15