Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] FindBoost.cmake
From: Brad King (brad.king_at_[hidden])
Date: 2009-10-29 15:56:52


troy d. straszheim wrote:
> Currently we work with cmake back to 2.6.4, I'd like to do something
> that works independently of cmake's Modules/FindBoost.cmake (I'm frankly
> afraid to even look inside that file). CMake will prefer that file
> unless NO_MODULE is specified, so for users of cmake that precede our
> upcoming FindBoost.cmake changes, the following will do the Right Thing
> if a Boost.CMake-built boost is installed:
>
> find_package(Boost 1.41.0 COMPONENTS signals NO_MODULE)
>
> as the Config mode path search will be done for a BoostConfig.cmake and
> BoostConfigVersion.cmake, and we win.

Correct.

> - Could the FindBoost.cmake module be set up to first perform a Config
> search, and then fall back to what it does now if that fails? e.g. I
> have a 2.8.1 cmake but a 1.33.1 boost from my old linux distro.

Yes. I recently did this for FindVTK.cmake in CMake HEAD (actually the
VTK one is complicated because it also has to support finding VTK 4.0
which did not distribute VTKConfig.cmake). Something like

  find_package(Boost QUIET NO_MODULE) # auto-forwards version request
  if(Boost_FOUND)
    # ...perhaps set things for compatibility with old approach...
    return()
  endif()
  # ...old approach...

at the top of FindBoost.cmake should do it.

> - How should this work in the presence of multiple simultaneous
> installed boosts? It looks to me like this isn't a standard use-case
> envisioned by find_package, but maybe I'm missing something.

When requesting a version number (1.41.0 argument), find_package will
ignore any BoostConfig.cmake that it sees that does not have a
BoostConfigVersion.cmake next to it that reports compatibility with
the requested version. Otherwise, there is no preferred ordering
among versions that claim compatibility. The first one to say yes
wins.

-Brad


Boost-cmake list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk