[CMake] Volunteering to maintain two new Find Modules

Alexander Neundorf a.neundorf-work at gmx.net
Thu Jan 8 17:04:46 EST 2009


Hi Albert,

On Thursday 08 January 2009, Albert Astals Cid wrote:
> A Dijous 08 Gener 2009, Alexander Neundorf va escriure:
> > On Wednesday 07 January 2009, Albert Astals Cid wrote:
> > > Hi, i'm new to the list, so i'm not sure if this is the correct
> > > procedure, i read a bit in the wiki and it seems it is, so here i am.
> > >
> > > I want to add upstream the two attached modules so we don't have to
> > > maintain them in poppler. I'll have to maintain them upstream but maybe
> > > more people will use them and find bugs/improve.
> > >
> > > They are pretty simple and work for us in poppler.
> > >
> > > Albert
> >
> > FindLIBOPENJPEG.cmake:
> >
> > That's not necessary, this is handled by
> > find_package_handle_standard_args(): if(LIBOPENJPEG_INCLUDE_DIR AND
> > LIBOPENJPEG_LIBRARIES)
> >   set(LIBOPENJPEG_FOUND TRUE)
> > endif(LIBOPENJPEG_INCLUDE_DIR AND LIBOPENJPEG_LIBRARIES)
> >
> > The first argument to find_package_handle_standard_args() should be the
> > exact name of the module without the "Find" and the ".cmake", so if the
> > filename if FindLIBOPENJPEG.cmake the first argument should be
> > "LIBOPENJPEG".
> >
> > The big if()/else()/endif() is not necessary. Current cmake even makes
> > sure automatically that it doesn't print the same message twice (in a
> > following cmake run).
> >
> > Similar comments apply to FindLCMS.cmake.
>
> So the ultimate version would be
>
> find_path(LIBOPENJPEG_INCLUDE_DIR openjpeg.h
>           PATH_SUFFIXES openjpeg openjpeg-1.0
>           PATHS /usr/include /usr/local/include)

/usr/include and /usr/local/include are searched by default, no need to add 
them explicitely.

> find_library(openjpeg_LIBRARY

This should be named LIBOPENJPEG_OPENJPEG_LIBRARY.
Then it has the proper prefix (i.e. the same as the filename) and e.g. 
cmake-gui will group it nicely in a tree.

>              NAMES openjpeg
>              PATHS /usr/lib /usr/local/lib)

Same for /usr/lib and /usr/local/lib

See Modules/Platform/UnixPaths.cmake for the default search directories.

And are you sure you want to name it "FindLIBOPENJPEG.cmake" and not 
maybe "FindLibOpenJPEG.cmake" ? That's the capitalization they use on their 
webpage.

Alex


More information about the CMake mailing list