0
$\begingroup$

Rosanswers logo

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.


Originally posted by ffusion on ROS Answers with karma: 13 on 2012-03-26

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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}.)


Originally posted by Stephan with karma: 1924 on 2012-03-26

This answer was ACCEPTED on the original site

Post score: 4

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.