How to make CMake find OpenRobots packages

Problem

CMake does not find OpenRobots packages like pinoccio, even though you have installed them using e.g. apt install robotpkg-pinocchio.

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

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

    pinocchioConfig.cmake
    pinocchio-config.cmake

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

Solution

You need to set the CMAKE_PREFIX_PATH environment variable to the path where the OpenRobots packages are installed. This is typically /opt/robotpkg.

cmake . -DCMAKE_PREFIX_PATH=/opt/robotpkg