[CMake] Volunteering to maintain two new Find Modules

Albert Astals Cid aacid at kde.org
Thu Jan 8 17:22:57 EST 2009


A Dijous 08 Gener 2009, Alexander Neundorf va escriure:
> 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.

Ok, so at the end it is

find_path(LibOpenJPEG_INCLUDE_DIR openjpeg.h
          PATH_SUFFIXES openjpeg openjpeg-1.0)

find_library(LibOpenJPEG_OPENJPEG_LIBRARY openjpeg)

if (LibOpenJPEG_OPENJPEG_LIBRARY)
  set (LibOpenJPEG_LIBRARIES ${openjpeg_LIBRARY})
endif (LibOpenJPEG_OPENJPEG_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBOPENJPEG DEFAULT_MSG 
LibOpenJPEG_LIBRARIES LibOpenJPEG_INCLUDE_DIR)

set(LibOpenJPEG_INCLUDE_DIRS ${LibOpenJPEG_INCLUDE_DIR})


But this noise in the list isn't worth if we don't get a proper ok/ko from the 
package maintainers regarding the fact of having this kind of FindFoo files 
in cmake upstream or not.

Albert

>
> Alex




More information about the CMake mailing list