0
$\begingroup$

Rosanswers logo

Hi, I have two catkin packages, one generating a library and the other makes use of it. In the cmake file of the dependent project, I have "link_directories( ${CATKIN_DEVEL_PREFIX}/lib/ )". This works fine with catkin_make, as the libxxx.so gets generated in devel/lib/. However when using catkin_make_isolated, the libxxx.so gets generated in devel_isolated/project_xxx/lib/ instead. And ${CATKIN_DEVEL_PREFIX} does not seem to dynamically substitute with the correct path according to the catkin command used. What cmake or catkin variable should I use for the link_directories to work in both cases?


Originally posted by blueberry on ROS Answers with karma: 3 on 2016-07-19

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You should not use link_directories at all.

In the package where you create the library:

  • export the library and the headers in the catkin_package call
  • install the library and the headers

in the package where you use it:

  • find_pacakge the pacakge above
  • use target_link_libraries(TARGET ${catkin_LIBRARIES}) and include_directores(${catkin_INCLUDE_DIRS})`

Originally posted by mgruhler with karma: 12390 on 2016-07-20

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by anonymous29979 on 2018-09-07:
For an explanation on why this works, read http://wiki.ros.org/catkin/CMakeLists.txt#Why_Are_Catkin_Packages_Specified_as_Components.3F

$\endgroup$

Your Answer

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