diff --git a/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake b/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake index a6d8263e..ef218b9b 100644 --- a/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake +++ b/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake @@ -121,7 +121,19 @@ rosidl_write_generator_arguments( ) if(NOT rosidl_generate_interfaces_SKIP_INSTALL) - ament_python_install_package(${PROJECT_NAME} PACKAGE_DIR "${_output_path}") + if(${PROJECT_NAME} IN_LIST AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES) + # TODO(esteve): replace this with ament_python_install_module and allow a list + # of modules to be passed instead of iterating over _generated_py_files + # See https://github.com/ros2/rosidl/issues/89 + foreach(_generated_py_dir ${_generated_py_dirs}) + install(DIRECTORY "${_output_path}/${_generated_py_dir}/" + DESTINATION "${PYTHON_INSTALL_DIR}/${PROJECT_NAME}/${_generated_py_dir}" + PATTERN "*.py" + ) + endforeach() + else() + ament_python_install_package(${PROJECT_NAME} PACKAGE_DIR "${_output_path}") + endif() endif() set(_target_suffix "__py")