2015-10-21 99 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前綴作爲其默認行爲。