Skip to content

target_link_libraries error in CMakeLists.txt (BT::behaviortree_cpp_v3) #366

@dujeong

Description

@dujeong

I use ROS foxy.

I want to use BT library in my ROS package.

So I add target_link_libraries(${PROJECT_NAME} BT::behaviortree_cpp_v3)

but, compile was failed.. (at this time, I install sudo apt install ros-foxy-behaviortree-cpp-v3)

...
set(BEHAVIOR_TREE_LIBRARY "BT::behaviortree_cpp_v3")
# Build
add_executable(bt_node ${SRC_FILES})
target_link_libraries(bt_node ${BEHAVIOR_TREE_LIBRARY}  )
target_include_directories(bt_node PUBLIC ${CMAKE_SOURCE_DIR}/include) #target scope
ament_target_dependencies(bt_node rclcpp std_msgs)
...

the build error is like this:

Target "bt_node" links to target "ament_index_cpp::ament_index_cpp" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?

after changing from BT::behaviortree_cpp_v3 to behaviortree_cpp_v3, compile was succeeded.
(at this time, I build from source code)

what is difference between BT::behaviortree_cpp_v3 and behaviortree_cpp_v3?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions