6

我在 Ubuntu 12.04 上安装了 Ogre3D 1.8.1(源代码包),一切都很顺利(我设法在 Ogre 界面上运行了一些示例)。但是,我在编译需要 OpenCV、ArUco 和 Ogre 库的外部项目(那个)时遇到了问题。当我运行项目的 CMake 时,我收到以下信息:

CMake Error at CMakeLists.txt:46 (find_package):
By not providing "FindOGRE.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OGRE", but
CMake did not find one.

Could not find a package configuration file provided by "OGRE" with any of
the following names:

OGREConfig.cmake
ogre-config.cmake

Add the installation prefix of "OGRE" to CMAKE_PREFIX_PATH or set
"OGRE_DIR" to a directory containing one of the above files.  If "OGRE"
provides a separate development package or SDK, be sure it has been
installed.


-- Configuring incomplete, errors occurred!

我知道 FindOGRE.cmake 在哪里,它在 /usr/local/lib/OGRE/cmake 中,但我不知道如何让 CMake 查找该文件夹并解决此问题。

4

4 回答 4

6

您只需要使用-D命令行选项和CMAKE_MODULE_PATH变量:

cmake . -DCMAKE_MODULE_PATH=/usr/local/lib/OGRE/cmake
于 2013-04-13T00:10:13.907 回答
2

只是为了记录,另一种解决方案是直接在 CMakeLists.txt 中添加模块路径。例如(在 Debian 9 上测试):

set(CMAKE_MODULE_PATH "/usr/share/OGRE/cmake/modules/;${CMAKE_MODULE_PATH}")

只需确保在调用 find_package 之前添加该行。

于 2018-03-09T12:10:57.593 回答
1

对我来说,它只能在CMakeLists.txtbefore中设置以下内容find_package

set(OGRE_DIR /usr/share/OGRE/build/sdk/CMake)

请注意,该CMake目录是包含OGREConfig.cmake. 出于某种原因,我的 CMake 忽略了CMAKE_MODULE_PATH.

也许,对某人有帮助

于 2018-10-12T11:57:12.110 回答
0

对我来说,这个解决方案适用于 manjaro:

set(CMAKE_MODULE_PATH "/usr/lib/OGRE/cmake;${CMAKE_MODULE_PATH}")
find_package(OGRE QUIET)

if (OGRE_FOUND)
    include_directories( ${ogre_INCLUDE_DIR})
    link_directories(${OGRE_LIBRARIES})
    message(STATUS "OGRE: FOUND")
else()
    message(STATUS "OGRE: NOT FOUND")
endif()
于 2020-11-29T19:17:56.857 回答