[CMake] OpenSceneGraph Find Modules

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Wed Dec 12 07:58:42 EST 2007


On Dec 10, 2007 9:40 AM, E. Wing wrote:
<snip>
> That's all I can remember on Mac issues for the moment. But on a
> general CMake issue, I just submitted a whole bunch of Find*.cmake
> modules for inclusion.
> http://www.cmake.org/Bug/view.php?id=6139
>
> Some of them are updates to existing modules that I have contributed.
> Others are brand new modules that I've been promising but needed to do
> significant clean up before submitting. (So that's where my weekend
> went.)
>
> FindFreeType.cmake
> FindGDAL.cmake
> FindGIFLIB.cmake
> FindLua50.cmake
> FindLua51.cmake
> FindOpenAL.cmake
> FindOpenSceneGraph.cmake
> FindOpenThreads.cmake
> FindPhysFS.cmake
> FindProducer.cmake
> FindQuickTime.cmake
> FindSDL.cmake
> FindSDL_image.cmake
> FindSDL_mixer.cmake
> FindSDL_net.cmake
> FindSDL_sound.cmake
> FindSDL_ttf.cmake
> Findosg.cmake
> FindosgDB.cmake
> FindosgFX.cmake
> FindosgGA.cmake
> FindosgIntrospection.cmake
> FindosgManipulator.cmake
> FindosgParticle.cmake
> FindosgProducer.cmake
> FindosgShadow.cmake
> FindosgSim.cmake
> FindosgTerrain.cmake
> FindosgText.cmake
> FindosgUtil.cmake
> FindosgViewer.cmake

Hello Eric,

I think these modules are a great addition to CMake. Thanks!

However, I took a look at them and I'm concerned with uniformity with
other modules. Now, I may be coming at it from a totally ignorant
point of view, since I don't know any history behind them (e.g., I'll
definitely not be aware of things that can't be changed do to
backwards compatibility, etc.), so please take these suggestions with
a grain of salt.

I think that for packages that are external components of OSG, such as
OpenGL, Producer, Quicktime, Lua, giflib, etc., there should be a
separate module. However, all OSG components should be found in the
same module (e.g., FindOpenSceneGraph.cmake). By having them separate
it increases the maintainence burden, and people are more likely to
get confused. If there are optional components, which you might or
might not want to link in, you can use the COMPONENTS/REQUIRED
interface of FIND_PACKAGE. For instance, the user would do something
like:

FIND_PACKAGE(OpenSceneGraph COMPONENTS DB FX GA Introspection)

to use those particular modules only. That's the way I do it in the
FindwxWidgets module. I suppose, you could also use the FindQt4
approach of having to set variables before calling the module (e.g.,
OSG_USE_DB, OSG_USE_FX, OSG_USE_GA, OSG_USE_INTROSPECTION).

Furthermore, if you already build OSG using CMake (great choice btw ;)
), then you might prefer to request the CMake cache variable
OpenSceneGraph_DIR to be set to the path of a file
OpenSceneGraphConfig.cmake (take a look at:  cmake --help-command
find_package), where all the configuration options that where used for
that particular OSG build can be found and so it is much user friendly
to use the module. The user would do:

FIND_PACKAGE(OpenSceneGraph) and by changing the location of the
OpenSceneGraph_DIR variable all the correct (as defined by the OSG
developers) options are set for that build.

I'm interested in standardizing the cmake find modules and I would
like to start using OpenSceneGraph some time soon for a course, so I'm
willing to volunteer some testing and development time into these
suggestions if you think they are reasonable and appropriate. Of
course, making the changes before releasing them with CMake helps
avoid backwards compatibility issues.

Hope this helps,
--Miguel


More information about the CMake mailing list