CMake find_package没有找到Find <package> .cmake

时间:2015-10-21 05:10:59

标签: c++ cmake catkin

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

我不确定我做错了什么

1 个答案:

答案 0 :(得分:1)

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

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

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