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

Referencing non-ROS packages dependencies

asked 2011-07-19 00:19:32 -0600

mbj gravatar image

updated 2014-01-28 17:10:03 -0600

ngrennan gravatar image

Hi.

I'm trying to reference a non-ROS package through one of my ROS package but I not have found the correct option in the CMakeList to make this correctly. I want to include the .h of this non-ROS package on to my files, but i don't find the method to make visible.

Thanks in advance and sorry for this simple question, but I don't find any answer in the tutorials.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2011-07-19 00:39:58 -0600

dornhege gravatar image

You use the standard cmake directives, i.e. include_directories(dir...) and target_link_libraries(bin lib...).

Additionally it is good practice to make a rosdep entry in the manifest if the library is a system package, so that other users can install the dependencies.

edit flag offensive delete link more
1

answered 2011-07-19 04:50:57 -0600

tfoote gravatar image

If you're trying to use software already installed on your system @dornhege has the right answer. If you're downloading and compiling the source inside your package you need to add the include_directories(dir...) and to expose the .h files upstream you need to add an export to your manifest for cflags

edit flag offensive delete link more
0

answered 2011-07-19 23:48:02 -0600

mbj gravatar image

updated 2011-07-20 20:29:10 -0600

Finally I solved the problem using the @dornhege answer and improvising a little. As you may know, you can link libraries with target_link_libraries, but if you want to link a object you must convert first the source (.cc, .cpp, ...) in a library (creating it with rosbuild_add_library) and latter link it with this command.

My problem was that I was trying to link directly a object as if was a library. But, there is any form to link directly a .o file without converting it firstly in a library?

edit flag offensive delete link more

Comments

yes: the compiler does nothing else then link .o files together, but if you have external code it is more elegant to build that into a library. If that code might be used by others follow the answer but tfoote.
dornhege gravatar image dornhege  ( 2011-07-20 04:14:27 -0600 )edit

Question Tools

Stats

Asked: 2011-07-19 00:19:32 -0600

Seen: 1,359 times

Last updated: Jul 20 '11