Ask Your Question
1

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

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

Huy Cong gravatar image

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

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
1

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

dornhege gravatar image

catkin_package is correct, see http://wiki.ros.org/catkin/CMakeLists...

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

Comments

1

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 -0500 )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 -0500 )edit
2

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 -0500 )edit

I tried catkin_package(.. CFG_EXTRAS {my_cmake}.cmake.develspace.in) 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 -0500 )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 .develspace.in. 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 -0500 )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 -0500 )edit
2

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 -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

1 follower

Stats

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

Seen: 116 times

Last updated: Mar 11 '15