Ask Your Question

Revision history [back]

I'm assuming this is the CMakeLists.txt of package B.

Thus, the install(.. part makes no sense. Why would you want to install something from INSIDE package B? Do you have a layout like B/include/A? Also, what do you expect ${A} do contain? This variable should not be set anywhere in here.

The same holds for the add_library call. Why do you, in package B want to build a package in A.

The answer you cite is correct, so please follow this.

  • In pkg A:
    • compile the library
    • install the library and Header files of pkg A (actually, not even required)
    • Export the include path and the library with the catkin_package call (check out the template when you create a new package)
  • In pkg B:
    • set up the build_depend to pkg A
    • find_package package A
    • add include_directories(${catkin_INCLUDE_DIRS})
    • include the Header in your package B code
    • link against the ${catkin_LIBRARIES}