如何让 CMake 找到 OpenRobots 包

问题

CMake 找不到像 pinoccio 这样的 OpenRobots 包,即使你已经使用例如 apt install robotpkg-pinocchio 安装了它们。

cmake_pinocchio_error.txt
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.

解决方案

你需要将 CMAKE_PREFIX_PATH 环境变量设置为 OpenRobots 包安装的路径。通常是 /opt/robotpkg

cmake_openrobots.sh
cmake . -DCMAKE_PREFIX_PATH=/opt/robotpkg

Check out similar posts by category: Robotics, CMake