FindOgre CMake script should be installed in default folder

Minor issues with the Ogre API that can be trivial to fix
Post Reply
andrewfenn
Halfling
Posts: 62
Joined: Fri Mar 23, 2007 2:48 pm
x 2

FindOgre CMake script should be installed in default folder

Post by andrewfenn »

The findOGRE cmake script should be installed in..

Code: Select all

DESTINATION "${CMAKE_ROOT}/Modules"
By doing this it becomes part of the global scope and one can do find_package(OGRE) without having to manually include the find cmake script in their own project.

This would ensure all projects have the most up to date version of the find ogre cmake script as well instead of relying on their own implementations derived from copy and pasting it into their own projects.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: FindOgre CMake script should be installed in default fol

Post by CABAListic »

Hm, the downside is that that directory is not generally writable by users on any platform, and thus the install step would always need administrative rights no matter where you install to. It's also not very transparent if we begin to install files to global places instead of the chosen install directory. Also, if you're working with different versions of Ogre, this could lead to problems as the script might have been altered between versions.

I know it's a little inconvenient, but you can always copy the script manually when you need it.
andrewfenn
Halfling
Posts: 62
Joined: Fri Mar 23, 2007 2:48 pm
x 2

Re: FindOgre CMake script should be installed in default fol

Post by andrewfenn »

Hm, the downside is that that directory is not generally writable by users on any platform, and thus the install step would always need administrative rights no matter where you install to.
It's not writable for me regardless if you install Ogre to /usr/ or /usr/local. I'm having trouble thinking of a situation where that's not the case? I always have to sudo make install on linux for example. I don't know how it works on windows or OSX however I don't see any issues with installing the cmake script where it belongs.
Also, if you're working with different versions of Ogre, this could lead to problems as the script might have been altered between versions.
If you really need to put cmake scripts in non standard area's of the system then why not just make it a cmake option with the default being to put cmake script where they should belong and are useful?

Right now it's getting installed to /usr/local/lib/OGRE/cmake/ which isn't useful at all unless you want to script up a "find the findOgre cmake script to then find Ogre" which is a little too meta for my tastes. :D
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: FindOgre CMake script should be installed in default fol

Post by CABAListic »

andrewfenn wrote: It's not writable for me regardless if you install Ogre to /usr/ or /usr/local. I'm having trouble thinking of a situation where that's not the case? I always have to sudo make install on linux for example. I don't know how it works on windows or OSX however I don't see any issues with installing the cmake script where it belongs.
I very rarely install to /usr or /usr/local, but often to somewhere in my home directory. That's a consequence of having to work with at least two Ogre versions, usually. And on Windows the default is to install inside the build directory. Here in particular installing to the CMake system location would be a problem because you would have to close and restart Visual Studio with administrator privileges. That's not something you'd do.
If you really need to put cmake scripts in non standard area's of the system then why not just make it a cmake option with the default being to put cmake script where they should belong and are useful?

Right now it's getting installed to /usr/local/lib/OGRE/cmake/ which isn't useful at all unless you want to script up a "find the findOgre cmake script to then find Ogre" which is a little too meta for my tastes. :D
Because imho we already have too many CMake options which aren't self-explanatory, and that would be yet another one... In any case, imho projects should always include any Find... scripts that aren't part of the standard CMake distribution, anyway. So just copy it to your project and adjust the CMAKE_MODULE_PATH accordingly :)
We could perhaps try and create a OGREConfig.cmake as an alternative. According to the docs, CMake should be able to pick that one up inside the /usr/local/lib/OGRE/cmake/ directory. However, when I wrote the first version of the FindOGRE script, I tried that and found it to be very inconvenient due to problems dealing with all the different build options and platforms.
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: FindOgre CMake script should be installed in default fol

Post by TheSHEEEP »

I agree that the find scripts should be part of each distribution and not be stored to a "global" path.
The reason is simply that one script to find X might work when another script to find X might not, and good luck getting the working one back once you overwrote it with the not working one ;)
My site! - Have a look :)
Also on Twitter - extra fluffy
andrewfenn
Halfling
Posts: 62
Joined: Fri Mar 23, 2007 2:48 pm
x 2

Re: FindOgre CMake script should be installed in default fol

Post by andrewfenn »

Ok, good to know. I won't bother with a pull request then. Typically this stuff get's patched on linux anyway so it's not really a problem for the packagers mostly only if you're installing via make install.
According to the docs, CMake should be able to pick that one up inside the /usr/local/lib/OGRE/cmake/ directory.
Could you point me to those docs? I've never seen that before or any other project that does this I just assumed it was junk being installed by accident.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: FindOgre CMake script should be installed in default fol

Post by CABAListic »

See http://www.cmake.org/cmake/help/v2.8.10 ... nd_package and scroll down to find a list of the directories CMake is searching; if /usr/local is in the CMake prefix path (which it should be), then that directory should be searched by CMake.

However, this only applies to a possible OGREConfig.cmake script (which we don't currently create), not the FindOGRE.cmake script.
andrewfenn
Halfling
Posts: 62
Joined: Fri Mar 23, 2007 2:48 pm
x 2

Re: FindOgre CMake script should be installed in default fol

Post by andrewfenn »

From looking at the docs shouldn't it then be in /usr/local/lib/cmake/OGRE/ ?

The docs show: <prefix>/(lib/<arch>|lib|share)/cmake/<name>*/

However I'm not sure that (lib/lib) here means lib/OGRE?
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: FindOgre CMake script should be installed in default fol

Post by CABAListic »

There's also <prefix>/(lib/<arch>|lib|share)/<name>*/(cmake|CMake)/ in the docs.
Post Reply