[CMake] Version checking in FindFoo.cmake modules

Matt Williams lists at milliams.com
Mon Nov 17 20:06:01 EST 2008


On Tuesday 18 November 2008 00:21:46 Matt Williams wrote:
> On Tuesday 18 November 2008 00:20:39 Alexander Neundorf wrote:
> > On Tuesday 18 November 2008, Matt Williams wrote:
> > > I was reading up on the documentation on the 2.6 version of
> > > find_package() and it seems that being able to pass a version string to
> > > it only works if find_package() uses a FooConfig.cmake file and not a
> > > FindFoo.cmake file.
> > >
> > > In other words, if I'm writing a FindFoo.cmake file, it seems that the
> > > PACKAGE_FIND_NAME, PACKAGE_FIND_VERSION etc. variables aren't set.
> > >
> > > I tried to make it work but I couldn't. Am I missing something or is it
> > > really not possible to do version checking with FindFoo.cmake modules?
> >
> > Did you check whether Foo_FIND_VERSION etc. are set ?
>
> Ahh, thanks. I was confused because Foo_FIND_VERSION was set, but
> Foo_FIND_NAME wasn't. Of course, that variable isn't necessary but it's
> strange that it would be defined in FooConfig.cmake files but not
> FindFoo.cmake.

One other thing: How do I find out if the user has set the 'EXACT' parameter 
in find_package()?

It seems that if it is set, there seems to be no way to say, "I found the 
package but it's not an exact match like you asked for". I'm setting the 
Foo_VERSION_EXACT variable to FALSE in this case but there's no way for me to 
do the logic in the FindFoo.cmake file and find_package() itself doesn't seem 
to error is EXACT was asked for and not received.

I assume there's something I'm missing again here

Regards,
Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081118/17e12501/attachment.pgp>


More information about the CMake mailing list