4

我制作并安装了 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)

我不确定我做错了什么

4

1 回答 1

5

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

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

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

于 2015-10-21T06:03:50.437 回答