问题描述
我制作并安装了aruco库,它将Findaruco.cmake文件放在/ usr / local / lib / cmake目录中。在我的CMakeLists.txt文件中,我有
...
find_package(aruco REQUIRED)
并且总是返回标准错误
通过在CMAKE_MODULE_PATH中不提供Findaruco.cmake,这个项目有
要求CMake找到由aruco提供的包配置文件,但
CMake没有找到一个。
无法找到由aruco提供的包配置文件与
中的任何一个以下名称:
arucoConfig.cmake
aruco-config。 cmake
将安装前缀aruco添加到CMAKE_PREFIX_PATH或将
aruco_DIR添加到包含上述文件之一的目录。如果aruco
提供了单独的开发包或SDK,请确保已经安装了
。
我已将环境变量$ CMAKE_PREFIX_PATH设置为以下各项, >
/ usr / local
/ usr / local / lib
/ usr / local / lib / cmake
唯一可行的是在CMakeLists中设置以下内容
set(CMAKE_MODULE_PATH / usr / local / lib / cmake)
我不确定我做错了什么
解决方案尝试设置 CMake CMAKE_PREFIX_PATH
,而不是环境一。在 cmake
调用期间使用-D标志:
cmake -D CMAKE_PREFIX_PATH = / usr / local / lib< path to source或build dir>
但是AFAIR,CMake应该查看 / usr / local
prefix作为其默认行为。
I made and installed the aruco library, which put a Findaruco.cmake file in the /usr/local/lib/cmake directory. In my CMakeLists.txt file I have
...
find_package(aruco REQUIRED)
and it always returns the standard error
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.
I've set the environment variable $CMAKE_PREFIX_PATH to each of the following, and none work
/usr/local
/usr/local/lib
/usr/local/lib/cmake
The only thing that works is setting the following in CMakeLists
set(CMAKE_MODULE_PATH /usr/local/lib/cmake)
I'm not sure what I'm doing wrong
解决方案 Try setting CMake variable called CMAKE_PREFIX_PATH
, not environment one. Use -D flag during cmake
invocation:
cmake -D CMAKE_PREFIX_PATH=/usr/local/lib <path to source or build dir>
But AFAIR, CMake should look into /usr/local
prefix as its default behavior.
这篇关于CMake find_package找不到Find< package> .cmake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!