[CMake] Volunteering to maintain two new Find Modules

Albert Astals Cid aacid at kde.org
Thu Jan 8 16:59:38 EST 2009


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)

find_library(openjpeg_LIBRARY
             NAMES openjpeg
             PATHS /usr/lib /usr/local/lib)

if (openjpeg_LIBRARY)
  set (LIBOPENJPEG_LIBRARIES ${openjpeg_LIBRARY})
endif (openjpeg_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBOPENJPEG DEFAULT_MSG 
LIBOPENJPEG_LIBRARIES LIBOPENJPEG_INCLUDE_DIR)

set(LIBOPENJPEG_INCLUDE_DIRS ${LIBOPENJPEG_INCLUDE_DIR})

Right?

Albert

>
> Alex
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake




More information about the CMake mailing list