[CMake] OpenSceneGraph Find Modules

Hendrik Sattler post at hendrik-sattler.de
Sat Jan 5 07:44:15 EST 2008


Am Samstag 05 Januar 2008 schrieb Pau Garcia i Quiles:
> Quoting Hendrik Sattler <post at hendrik-sattler.de>:
> > Am Samstag 05 Januar 2008 schrieb Alexander Neundorf:
> >> On Friday 04 January 2008, Hendrik Sattler wrote:
> >> ...
> >>
> >> > > Then I have a FindZeroCIce.cmake which essentially has this code:
> >> > >
> >> > > [...]
> >> > > SET( ZeroCIceCore_FIND_QUIETLY TRUE )
> >> > > SET( ZeroCIceBox_FIND_QUIETLY TRUE )
> >> > > SET( ZeroCIceGrid_FIND_QUIETLY TRUE )
> >> > > SET( ZeroCIcePatch2_FIND_QUIETLY TRUE )
> >> > > SET( ZeroCIceSSL_FIND_QUIETLY TRUE )
> >> > > SET( ZeroCIceStorm_FIND_QUIETLY TRUE )
> >> > > SET( ZeroCIceUtil_FIND_QUIETLY TRUE )
> >> > > SET( ZeroCIceXML_FIND_QUIETLY TRUE )
> >> > > SET( ZeroCIceExecutables_FIND_QUIETLY TRUE )
> >> > > SET( ZeroCIceFreeze_FIND_QUIETLY TRUE )
> >> > > SET( ZeroCIceGlacier2_FIND_QUIETLY TRUE )
> >> > >
> >> > > FIND_PACKAGE( ZeroCIceCore )
> >> >
> >> > or simpler:
> >> > foreach ( i Core Box Grid Patch2....)
> >> >   set ( ZeroCIce${i}_FIND_QUIETLY TRUE )
> >> >   find_package ( ZeroCIce${i} )
> >> > endforeach ( i )
> >> > That's not really worth a seperate module file.
> >> >
> >> > Maybe a scheme for module subdirectories should be created and added
> >> > to CMake? There are probably plenty of such projects that are splitted
> >> > into numerous sub-parts. A
> >> >   find_package ( ZeroCIce COMPONENTS Core Box )
> >> > could then automatically resolv to the above two parts but for the
> >> > module files:
> >> >   FindZeroCIce/Core.cmake and
> >> >   FindZeroCIce/Box.cmake
> >> >
> >> > If that cannot be included into CMake, such modules could include the
> >> > files in the subdir and evaluate the COMPONENTS themselves in a
> >> > FindZeroCIce.cmake. IMHO using a subdirectory is way better than
> >> > putting everything in the file name because at one point, the
> >> > directory listing of the modules directory will not be readable
> >> > anymore :-(
> >>
> >> Yes.
> >> Can you please open a feature request in the bug tracker for that ?
> >
> > I don't work with have a project with such needs. However, if the module
> > maintainers of the already mentioned project would use such a scheme, I
> > suggest that they file the feature request.
> > So the question is: What do the ZeroCIce and OSG module writers think
> > about a scheme with subdirectories?
>
> I certainly like it, although I'd prefer to call the subdir differently:
>
> /usr/share/cmake-2.4/Modules/FindZeroCIce.cmake
> /usr/share/cmake-2.4/Modules/ZeroCIce/Box.cmake
> /usr/share/cmake-2.4/Modules/ZeroCIce/Core.cmake
> /usr/share/cmake-2.4/Modules/ZeroCIce/Grid.cmake
> ...
>
> I think this naming makes easier to have UseZeroCIce.cmake and
> FindZeroCIce.cmake. Calling the subdir FindZeroCIce, CMake would have
> to search for UseFindZeroIce.cmake or be smart enough to strip "Find"
> from the subdirname.

Actually, the idea is to not need FindZeroCIce.cmake (in your case) at all but 
let CMake itself handle the COMPONENT argument to find_package. How that is 
done is to be discussed (like calling all components when none was 
specified).

> Anyway, FindZeroCIce*.cmake are not part of CMake. Right now, the only
> finders in CMake CVS which could take advantage of the subdir are
> Findosg*.cmake and FindSDL_*.cmake.

I know but e.g. Qt4 could also use it, I guess.

HS


More information about the CMake mailing list