Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to include a ros-unrelated library with target_link_libraries


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.