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

How to include a ros-unrelated library with target_link_libraries

asked 2012-03-26 22:32:40 -0500

ffusion gravatar image

Hello,

I want use a library called libnpsauv.a in my package. Although I know that I have to use target_link_libraries i don't know how to use it properly.

I tried:

target_link_libraries(${PROJECT_NAME} npsauv)

But then I got that when rosmaking:

{------------------------------------------------------------------------------- mkdir -p bin cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=rospack find rosbuild/rostoolchain.cmake .. [rosbuild] Building package npsauv_simulation [rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/roslisp/cmake/roslisp.cmake [rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/rospy/cmake/rospy.cmake [rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake CMake Error at CMakeLists.txt:26 (target_link_libraries): Cannot specify link libraries for target "npsauv_simulation" which is not built by this project.

-- Configuring incomplete, errors occurred! -------------------------------------------------------------------------------}

Note: I copied the library into the lib package folder.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2012-03-26 23:34:47 -0500

Stephan gravatar image

You have to specify the name of the executable which needs your library as target:

 target_link_libraries(my_node npsauv)

(In your case CMake complains because there is no target named ${PROJECT_NAME}.)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-03-26 22:32:40 -0500

Seen: 1,773 times

Last updated: Mar 26 '12