diff --git a/tesseract/tesseract_collision/CMakeLists.txt b/tesseract/tesseract_collision/CMakeLists.txt index ecb89ec26d7..3b33286e67d 100644 --- a/tesseract/tesseract_collision/CMakeLists.txt +++ b/tesseract/tesseract_collision/CMakeLists.txt @@ -114,6 +114,11 @@ install(DIRECTORY include/${PROJECT_NAME} install(FILES package.xml DESTINATION share/${PROJECT_NAME}) +# Create an ament_index resource file to allow ROS2 ament_index_cpp to locate the installed path to this package. +# This is a workaround to let the ROS2 version of pluginlib find tesseract_collision's plugins, since tesseract_collision is a non-ROS CMake package. +# ADDITIONAL REQUIREMENT: The installed path must be added to the AMENT_PREFIX_PATH environment variable at runtime, which is outside the scope of CMakeLists.txt. +file(WRITE ${CMAKE_INSTALL_PREFIX}/share/ament_index/resource_index/packages/${PROJECT_NAME} "") + # Create cmake config files include(CMakePackageConfigHelpers) configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/${PROJECT_NAME}-config.cmake.in