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

Revision history [back]

click to hide/show revision 1
initial version

Anyone able to help me solve this in an elegant way?

Do you have a reason for wanting to directly include src files from package2 into programA? We normally (not just in ROS / with catkin) solve these kind of things by creating a library in package2, making sure package2/include is on the include path of whatever pkg programA is in, and then linking libpkg2 to programA.

Anyone able to help me solve this in an elegant way?

Do you have a reason for wanting to directly include src files from package2 into programA? ?

We normally (not just in ROS / with catkin) solve these kind of things by creating a library in package2, making sure package2/include is on the include path of whatever pkg programA is in, and then linking libpkg2 to programA.

I would consider using libraries like this an elegant way.

Anyone able to help me solve this in an elegant way?

Do you have a reason for wanting to directly include src files from package2 into programA?

We normally (not just in ROS / with catkin) solve these kind of things by creating a library in package2, making sure package2/include is on the include path of whatever pkg programA is in, and then linking libpkg2 to programA.

I would consider using libraries like this an elegant way.


Edit:

Whilst your suggestion is fine, it's not the way we handle this kind of situation in our Lab, when using our own build system. Catkin/CMake is not our preferred tool chain. With that in mind, I prefer to reference it in the other package than create a duplicate.

Well, I must say that I wouldn't put recompiling source files for every target under elegant, but just to answer your question:

it would appear the variable <pkg_name>_SOURCE_PREFIX contains the path your are looking for. I haven't used this myself, and afaict it is undocumented (which means it may stop working / be removed at any time), but it should get you what you are after.

Anyone able to help me solve this in an elegant way?

Do you have a reason for wanting to directly include src files from package2 into programA?

We normally (not just in ROS / with catkin) solve these kind of things by creating a library in package2, making sure package2/include is on the include path of whatever pkg programA is in, and then linking libpkg2 to programA.

I would consider using libraries like this an elegant way.


Edit:

Whilst your suggestion is fine, it's not the way we handle this kind of situation in our Lab, when using our own build system. Catkin/CMake is not our preferred tool chain. With that in mind, I prefer to reference it in the other package than create a duplicate.

Well, I must say that I wouldn't put recompiling source files for every target under elegant, but just to answer your question:

it would appear the variable <pkg_name>_SOURCE_PREFIX contains the path your are looking for. I haven't used this myself, and afaict it is undocumented (which means it may stop working / be removed at any time), but it should get you what you are after.

after. Note that you must've find_package(..) the pkg first, or have included it in a find_package(catkin .. COMPONENTS ..) call.