Error with Ogre and CMake
Asked Answered
A

4

7

I installed Ogre3D 1.8.1 (the source package) on Ubuntu 12.04 and everything went fine (I managed to run some samples on the Ogre interface). However, I hit a problem while I was compiling an external project (that one) that needed the OpenCV, ArUco and Ogre librarys. When I run the CMake of the project, I receive the following:

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!

I know where the FindOGRE.cmake is, it's in the /usr/local/lib/OGRE/cmake, but I don't know how to say to CMake to look for that folder and fix this problem.

Amble answered 13/4, 2013 at 0:0 Comment(0)
T
6

You just need to use the -D command line option along with the CMAKE_MODULE_PATH variable:

cmake . -DCMAKE_MODULE_PATH=/usr/local/lib/OGRE/cmake
Tabasco answered 13/4, 2013 at 0:10 Comment(3)
I tried the -D command, as you said, but I still hit the same problem. I also tried use the CMake-gui. I filled the CMAKE_INSTALL_PREFIX with the /usr/local/lib/OGRE/cmake path, and the OGRE_DIR with the ogre installation folder. Is that right? Even so, occurs the same error.Schroder
Well, the CMAKE_INSTALL_PREFIX is where you will install your current project to if you do make install, so it's not really relevant here. CMAKE_MODULE_PATH is a list of directories where CMake checks for "FindXXX.cmake" files when you use find_package. Finally, setting OGRE_DIR (or CMAKE_PREFIX_PATH) to the ogre installation dir would need a file called OGREConfig.cmake or ogre-config.cmake to exist. One of these would exist if ogre provided them (they are generated via install(export...)). This is really what should be provided by ogre rather than FindOGRE.cmake I think.Tabasco
Hi. I am using "Linux Mint 14". And the trick is find the cmake ogre files. In my system, the command line for cmake is cmake . -DCMAKE_MODULE_PATH=/usr/share/OGRE/cmake/modules/ .Consumer
R
2

Just for the record, an alternative solution would be to add the module path directly in the CMakeLists.txt. For example (tested on Debian 9):

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

Just make sure to add the line before find_package is called.

Ribbentrop answered 9/3, 2018 at 12:10 Comment(0)
C
1

For me, it only works to set the following in CMakeLists.txt before find_package:

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

Note that the CMake directory is the one containing OGREConfig.cmake. For some reason, my CMake ignores CMAKE_MODULE_PATH.

Maybe, of some help for someone

Confiscate answered 12/10, 2018 at 11:57 Comment(0)
W
0

For me, this solution work on 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()
Wallpaper answered 29/11, 2020 at 19:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.