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

what must i add to the cmakefile.txt

asked 2013-01-28 07:15:15 -0600

mrpiccolo gravatar image

hi I want create a node that uses a library that is installed in my pc. To compile i typed: gcc -o myprogram myprogram.c -l rt -l bcm2835

what must i add to the cmakefile.txt? thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2013-01-28 09:25:25 -0600

thebyohazard gravatar image

As in any other cmake project, you'd put target_link_libraries(${PROJECT_NAME) <NAME_OF_LIBRARY_TO_LINK>) in your CmakeLists.txt. There wasn't any ros-specific cmake macro for using an installed library in a node in rosbuild, and if I understand correctly, the new catkin build system does not use ANY ros-specific macros. I haven't actually used catkin yet, though. Some useful links:

edit flag offensive delete link more
0

answered 2013-01-29 05:58:50 -0600

mrpiccolo gravatar image

thanks for the answer I tried: target_link_libraries(${NAME_OF_MY_NODE) <name_of_library_to_link>) target_link_libraries(${NAME_OF_MY_NODE) NAME_OF_LIBRARY_TO_LINK) target_link_libraries(NAME_OF_MY_NODE NAME_OF_LIBRARY_TO_LINK)

But doesn't work

other suggestions?

edit flag offensive delete link more

Comments

You need to replace NAME_OF_LIBRARY_TO_LINK by the name of the library to link.

dornhege gravatar image dornhege  ( 2013-01-29 06:43:33 -0600 )edit

I know

mrpiccolo gravatar image mrpiccolo  ( 2013-01-29 10:42:44 -0600 )edit

Please state exactly what you actually did and what the errors are by copy/pasting this information and updating your original question. Different cmake commands than you used and "But doesn't work" will not enable anyone to infer any solutions.

dornhege gravatar image dornhege  ( 2013-01-29 22:54:53 -0600 )edit

I tried "target_link_libraries(NODE rt bcm2835) and now work

mrpiccolo gravatar image mrpiccolo  ( 2013-01-30 22:46:20 -0600 )edit

thanks and sorry for the delay but yesterday was a bad day

mrpiccolo gravatar image mrpiccolo  ( 2013-01-30 22:48:19 -0600 )edit

Question Tools

Stats

Asked: 2013-01-28 07:15:15 -0600

Seen: 355 times

Last updated: Jan 29 '13