On 02/10/2011 09:03 AM, Micha Renner wrote:
> There is a library, which is described with these TLIBConfig.cmake,
> TLIBConfigVersion.cmake files (The version of the library is 2.1).
> 
> The library is used by
> FIND_PACKAGE(TLIB 2.30 QUIET)
> 
> Is there a way to check the version of the library after FIND_PACKAGE?
> E.g., if TLIB_VERSION would have a value, then the library exists, but
> has the wrong version.
> 
> Micha

AFAICS from the documentation in [1], FIND_PACKAGE() is not obliged to
set TLIB_VERSION et al. if no acceptable TLIBConfig[Version].cmake has
been found, and that's quite reasonable: Suppose you've multiple TLIB
installations, and all of them have inacceptable versions; which one
would you expect to be mentioned in TLIB_VERSION?

IMO, the best you can do in order to find out an available package's
actual version after the search for a specific version has failed is:

FIND_PACKAGE(TLIB 2.30 QUIET)
IF(NOT TLIB_FOUND)
    FIND_PACKAGE(TLIB QUIET)
    # Check actual version.
ENDIF()

Here, of course, I'm relying on the assumption that a FIND_PACKAGE()
call without version means that I'm willing to accept any version,
and that the package's version file behaves accordingly.

Regards,

Michael

> [1] http://www.cmake.org/Wiki/CMake/Tutorials/Packaging#Package_Version_Files
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to