'colcon build error on Ros2 Foxy Unity-Robotics-Hub example

I am following ROS–Unity Integration tutorial for ROS2. I coppied unity_robotics_demo and unity_robotics_demo_msgs to my src folder from here. When building unity_robotics_demo_msgs gives me an error. I did source install/setup.bash and colcon build. Error:

CMake Error at CMakeLists.txt:7 (find_package):
  By not providing "Findrosidl_default_generators.cmake" in CMAKE_MODULE_PATH
  this project has asked CMake to find a package configuration file provided
  by "rosidl_default_generators", but CMake did not find one.

  Could not find a package configuration file provided by
  "rosidl_default_generators" with any of the following names:

    rosidl_default_generatorsConfig.cmake
    rosidl_default_generators-config.cmake

  Add the installation prefix of "rosidl_default_generators" to
  CMAKE_PREFIX_PATH or set "rosidl_default_generators_DIR" to a directory
  containing one of the above files.  If "rosidl_default_generators" provides
  a separate development package or SDK, be sure it has been installed.

I am not sure how to add the installation prefix. In foxy/share there is rosidl_default_generators:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source