Ogre和CMake出错

时间:2013-04-13 00:00:19

标签: cmake ogre

我在Ubuntu 12.04上安装了Ogre3D 1.8.1(源代码包),一切都很顺利(我设法在Ogre界面上运行了一些示例)。但是,当我编译需要OpenCV,ArUco和Ogre图书馆的外部项目(that one)时,我遇到了问题。当我运行项目的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中,但我不知道怎么说要查找该文件夹并解决这个问题。

4 个答案:

答案 0 :(得分:4)

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

cmake . -DCMAKE_MODULE_PATH=/usr/local/lib/OGRE/cmake

答案 1 :(得分:0)

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

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

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

答案 2 :(得分:0)

对我来说,仅在CMakeLists.txt之前的find_package中进行以下设置:

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

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

也许对某人有帮助

答案 3 :(得分: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()