[CMake] FindBoost.cmake from 2.6

Doug Gregor doug.gregor at gmail.com
Thu Jul 3 20:54:17 EDT 2008


On Thu, Jul 3, 2008 at 6:33 PM, Fernando Cacciola
<fernando.cacciola at gmail.com> wrote:
> OK, I found the problem today.
> The version is parsed (from version.hpp) into a variable named
> Booist_MAJOR_VERSION (et al)
> But the comparison code incorrectly uses Boost_VERSION_MAJOR.
> (Haven't tryed the latest patch though, just the "official" 2.6)

Ah, right. We fixed this in CMake CVS. There were some other issues
with the version-checking logic, too, that have been fixed.

> No, sorry, I was clear enough because my example code was wrong though. I
> meant that this:
>
> I tried *this* version of FindBoost with 2.4.7 and 2.4.8 and it just works
> :) with one exception: the version number in the find_package command is
> ignored prior to 2.6.
> But, that exception doesn't matter in practice becasue you can redundantly
> store the minimum required version manually in vairables of the form
> Boost_FIND_VERSION etc, like this:
>
> set( Boost_FIND_VERSION 1.33.1 )
> set( Boost_FIND_VERSION_MAJOR 1 )
> set( Boost_FIND_VERSION_MINOR 33 )
> set( Boost_FIND_VERSION_PATCH 1 )
>
> find_package(Boost 1.33.1 REQUIRED thread whatever )
>
> that code works in 2.4.7, 2.4.8 and 2.6 as far as I tested it. And in all
> cases with the same FindBoost.cmake (the one we are discussing)

Okay. You'll need some minor tweaks to use this module with CMake <
2.6.1, because of the use of the HINTS argument to find_path et al.
However, it's a simple tweak.

  - Doug


More information about the CMake mailing list