So following example:
I have Package A
with the function doA();
and I have Package B
inside my catkin_ws. Now If I want to use doA();
in package B I would add the following to the package.xml of B: <depend>A</depend>
and it works.
Now the case with an external library:
So lets assume my Package A
needs an external library outside of my catkin_workspace. For example something in /home/tom/lib/
. Now I link this external library to my Package A
by changing the CMakeLists.txt
:
find_library(EX_LIB el HINT /home/tom/lib/)
target_link_libraries(A ${EX_LIB})
target_link_libraries(test_A ${PROJECT_NAME}
${EX_LIB})
No when I try to run doA();
in Package B
it will not work. The dependency in the package.xml is not enough, I have to link the external Library in the CMakeLists.txt of B too. Why? And how can I integrate that external library the right way into my catkin_ws, so I do not have to link it in every package that uses Package A.
Edit: I think my problem is similar to this:ROS-External-Wrapper , but in my case I do not have the source files only the prebuilt libraries.