[CMake] FindOpenEXR.cmake inclusion in cmake modules?

Alexander Neundorf a.neundorf-work at gmx.net
Thu Jun 16 14:38:38 EDT 2011


On Thursday 16 June 2011, Campbell Barton wrote:
> 2011/6/16 Alexander Neundorf <a.neundorf-work at gmx.net>:
> > On Thursday 16 June 2011, David Cole wrote:
> >> First, ask if the module is really necessary. If, instead, you can add
> >> an OpenEXRConfig.cmake file to the OpenEXR project itself, and install
> >> it in a place that cmake's find_package will automatically find it,
> >> then a find module is unnecessary.
> >> 
> >> However, if that's not possible or practical, then...
> >> 
> >> Follow the directions here on becoming a module maintainer:
> >> 
> >>   http://www.cmake.org/Wiki/CMake:Module_Maintainers
> >> 
> >> If anything is unclear, ask here for clarification.
> >> 
> >> 
> >> Thanks,
> >> David
> 
> Is writing a ***Config.cmake file documented?, 

Yes. There should be something in the wiki, and the make page for cmake, under 
find_package().
Here is also an exmaple how to do it for a library:
https://projects.kde.org/projects/kde/kdeexamples/repository/revisions/master/show/buildsystem/HowToInstallALibrary

> does this rely on
> OpenEXR using cmake for their builds?

Well, they can be also written manually, but for somebody who isn't fluent 
with cmake it's IMO not really an option.

> I wasn't aware of this.
> 
> >> On Wed, Jun 15, 2011 at 11:25 PM, Campbell Barton
> > 
> > <ideasman42 at gmail.com>wrote:
> >> > Recently I decided to start moving some of our projects hard coded
> >> > paths into Find***.cmake modules.
> >> > 
> >> > Incidentally the libs are libsamplerate, libFFTW3, libsndfile,
> >> > libjemalloc, OpenEXR, OpenJPEG, libpcre.
> >> > 
> >> > I started out with OpenEXR, and tried to comply with the module
> >> > readme.txt, and used FindTIFF/Boost/OpenGL as references too.
> >> > 
> >> > Heres the module,
> >> > 
> >> > https://svn.blender.org/svnroot/bf-blender/trunk/blender/build_files/c
> >> > mak e/Modules/FindOpenEXR.cmake
> > 
> > I think you should not need to set _openexr_SEARCH_DIRS, I think all
> > these paths are included in the standard search paths.
> 
> does this work for FIND_PATH as well as FIND_LIBRARY?

Yes.
 
> >> > _after_ writing this I found that there are 3 other projects who also
> >> > wrote their own FindOpenEXR.cmake modules,
> >> > 
> >> > 
> >> > http://code.google.com/p/nvidia-texture-tools/source/browse/trunk/cmak
> >> > e/F indOpenEXR.cmake?r=HEAD
> >> > 
> >> > http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trun
> >> > k/C MakeModules/FindOpenEXR.cmake?rev=HEAD
> >> > http://www.openlibraries.org/browser/trunk/FindOpenEXR.cmake
> > 
> > And another one:
> > http://quickgit.kde.org/?p=kdelibs.git&a=blob&h=405b892d436823ac3b102b4eb
> > 0a1126bc168aec7&hb=9be5b41d4e933d019d3d30cead9143b3703d10f4&f=cmake/modul
> > es/FindOpenEXR.cmake
> > 
> > Alex
> 
> Noticed KDE's FineOpenEXR.cmake uses pkg-config, Is this considered
> best practice?

Personally, I don't consider it best practice.

Alex


More information about the CMake mailing list