2015-10-21 330 views
1

我制作并安装了aruco库,它将Findaruco.cmake文件放在/ usr/local/lib/cmake目录中。在我的CMakeLists.txt文件我有CMake find_package找不到<package> .cmake

... 
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) 

我不知道我做错了什么

+0

CMake文档在哪里查找CMake模块:https://cmake.org/cmake/help/v3.0/command/find_package.html因此,与前缀路径相比,模块路径看起来更适合我。 – usr1234567

回答

0

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

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

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