[CMake] Make a Find"lib" generic

Brad King brad.king at kitware.com
Mon Sep 18 15:08:21 EDT 2006


Xavier Larrode wrote:
> I have done lots of FindPackage (for linux) for Ogre, Cegui, GLADE2
> etc... And i would like to make it generic.
[snip]
> So the question is, how to provide an argument to an INCLUDE (file) and
> use it

You can just set a variable before the INCLUDE command.  However you
should probably instead provide separate Find*.cmake files for each one.
 Their implementation could just include the generic one and invoke a macro:

# GenericFind.cmake
MACRO(GENERIC_FIND name)
  ... find script here using ${name}...
ENDMACRO(GENERIC_FIND)

# FindFoo.cmake
INCLUDE(GenericFind)
GENERIC_FIND(Foo)

-Brad


More information about the CMake mailing list