[CMake] OpenSceneGraph Find Modules

Pau Garcia i Quiles pgquiles at elpauer.org
Sat Jan 5 07:33:14 EST 2008


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.

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.

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)



More information about the CMake mailing list