[CMake] Re: FindBoost.cmake: please test

Brad King brad.king at kitware.com
Mon Jan 21 08:53:58 EST 2008


Andreas Pakulat wrote:
> On 20.01.08 17:11:17, Rodolfo Lima wrote:
>> Andreas Pakulat escreveu:
>>
>>> Naah, _boost_XXX is internal and not exposed. I rather have a
>>> Boost_MINIMUM_VERSION. That would also allow to use REQUIRED and a more
>>> verbose message saying wether the version is wrong or a needed lib is
>>> not found.
>> Speaking of which, find_package could have a way to specify required
>> versions, isn't? Like pkg-config does... That's a common use case.
>> Something along the lines of:
>> find_package(Boost MINIMUM_VERSION 1.34.1)
> 
> There is actually already a way to specify major.minor with find_package
> (see man cmake). Unfortunately this is not yet handled by cmake, even
> more sad that there are two wishlist reports for this since 2005.
> Entries #4243 and #1645

I've just implemented the request in 1645 in CMake HEAD.  If you call

  find_package(Boost 1.34.1)

the FindBoost.cmake module will receive the variable settings

  Boost_FIND_VERSION = 1.34.1
  Boost_FIND_VERSION_MAJOR = 1
  Boost_FIND_VERSION_MINOR = 34
  Boost_FIND_VERSION_PATCH = 1

As documented in the command and Modules/readme.txt the module should
find a version that is compatible with that requested.  It is up to the
module to actually enforce this.  If it does, then the module should
report the version found in variables

  Boost_VERSION_STRING
  Boost_VERSION_MAJOR
  Boost_VERSION_MINOR
  Boost_VERSION_PATCH

The convention for these variables is specified in Modules/readme.txt
but the module should document how it sets them.

-Brad


More information about the CMake mailing list