[CMake] find_package, quiet and yyyConfig files

Micha Renner Micha.Renner at t-online.de
Thu Feb 10 09:37:12 EST 2011


Am Donnerstag, den 10.02.2011, 15:12 +0100 schrieb Michael Hertling:
> 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.
But I have the version (TLIB_VERSION) and then I can react. This was a
really good idea. Thank you very much.

Micha




More information about the CMake mailing list