Do I need to install a ros package in order to use its libraries in the same catkinws?
I have a project in a catkin workspace. I'm developing it inside a docker container and this is my only alternative. For this reason I do not want to install any package, as the containers are not persistent.
I have several packages inside the catkin directory and some of then are plugins libraries. I would like to use the libraries of my package A in the package B without installing the package A. I have not been able to do this using the cmake command
find_package(catkin REQUIRED COMPONENTS packageA)
include_directories(${catkin_INCLUDE_DIRS})
target_link_libraries(package_B_node ${catkin_LIBRARIES})
to add the required includes and the libraries
Asked by rafaelrojas on 2020-11-20 12:57:28 UTC
Answers
For inter-package dependencies inside a catkin workspace, you need to follow two steps:
- Include your package in find_package in
CMakeLists.txt
find_package(catkin REQUIRED COMPONENTS packageA)
- Add dependencies both build and execute dependencies in your
package.xml
<build_depend>packageA</build_depend> <exec_depend>packageA</exec_depend>
`
Asked by Tahir M. on 2020-11-21 13:25:37 UTC
Comments
Yes I can.
The problem is that I forgot the following signature of the catkin_package
command in the CMakeLists.txt
of the packageA
catkin_package(INCLUDE_DIRS include LIBRARIES plugin_triangle polygons)
without these arguments incatkin_package
catkin did not generate the right information in catking_workspace/devel/share/packageA/cmake/packageAConfig.cmake
in order to expose the address of the headers and the libraries in the ${catkin_INCLUDE_DIRS} and ${catkin_LIBRARIES} inside the CMakeList.txt of packageB once the find_package
function is called.
Asked by rafaelrojas on 2020-11-22 12:36:45 UTC
Comments
Can you git clone or otherwise copy the source of package A into the catkin_ws alongside package B?
Or create a new docker image that uses the base docker image you can't alter as a starting point in the Dockerfile and then install package A as the only additional step?
Asked by lucasw on 2020-11-21 13:26:27 UTC