【问题标题】:CMake find_package not finding Find<package>.cmakeCMake find_package 找不到 Find<package>.cmake
【发布时间】:2016-01-19 23:34:57
【问题描述】:

我制作并安装了 aruco 库,该库将 Findaruco.cmake 文件放在 /usr/local/lib/cmake 目录中。在我的 CMakeLists.txt 文件中,我有

...
find_package(aruco REQUIRED)

它总是返回标准错误

By not providing "Findaruco.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "aruco", but
CMake did not find one.

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

    arucoConfig.cmake
    aruco-config.cmake

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

我已将环境变量 $CMAKE_PREFIX_PATH 设置为以下各项,但均无效

/usr/local  
/usr/local/lib  
/usr/local/lib/cmake  

唯一可行的方法是在 CMakeLists 中设置以下内容

set(CMAKE_MODULE_PATH /usr/local/lib/cmake)

我不知道我做错了什么

【问题讨论】:

标签: c++ cmake catkin


【解决方案1】:

尝试设置名为 CMAKE_PREFIX_PATHCMake 变量,而不是环境一。在cmake 调用期间使用-D 标志:

cmake -D CMAKE_PREFIX_PATH=/usr/local/lib <path to source or build dir>

但 AFAIR,CMake 应该将 /usr/local 前缀视为其默认行为。

【讨论】:

猜你喜欢
  • 2018-02-06
  • 1970-01-01
  • 1970-01-01
  • 2022-12-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多