ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Compiling the comments into an answer:
Package: new_policies_system
CMakeLists.txt should include:
find_package(catkin REQUIRED COMPONENTS
roscpp
social_layers
...
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES new_policies_system
CATKIN_DEPENDS
roscpp
social_layers
...
DEPENDS
EIGEN3
)
include_directories(
include
${catkin_INCLUDE_DIRS}
...
)
add_library(new_policies_system
src/Policy.cpp
...
)
target_link_libraries(new_policies_system
${catkin_LIBRARIES}
${EIGEN3_LIBRARIES}
)
add_dependencies(new_policies_system
${catkin_EXPORTED_TARGETS}
)
Note I have replaced {PROJECT_NAME}
with new_policies_system
to be consistent across the library, linking, and dependencies.
package.xml should include:
<depend>social_layers</depend>
Package: social_layers
CMakeLists.txt should include:
catkin_package(
INCLUDE_DIRS include
LIBRARIES person
CATKIN_DEPENDS pal_detection_msgs
)
add_library(person
src/person.cpp
)
target_link_libraries(person
${catkin_LIBRARIES}
)
Note I have added a target_link_libraries
for the person
library. If you use any external code in person
then you should keep this call in there. Only add the names of libraries you are creating in this package to the catkin_package
LIBRARIES
section. IE do NOT keep social_layers
in there unless you have an add_library(social_layers src/path/to/code.cpp)
Final note when making changes to library names and CMakeLists in general. If you are experiencing strange behavior, try clearing out devel, build, and log directories. Just because you changed the name of something and recompile, the original probably still exists with the wrong name.
The ROS wiki has in depth info as well and is worth a read.