[CMake] finding boost

Raymond Wan rwan.work at gmail.com
Tue Mar 3 08:15:38 EST 2015


Hi Dave,


On Tue, Mar 3, 2015 at 6:20 PM, Dave Yost <Dave at yost.com> wrote:
> I’m having trouble with the find_package documentation w.r.t. boost.
>
> I can’t divine how to get find_package to look for boost in various places it might be on the various systems where we do builds. I know boost looks in several places, but I need to add to that list.
>
> Boost might be in any of these places
>  /usr/local/include/boost
>  /usr/local/boost/1.57.0/include
>  /usr/local/boost/1.56.0/include   etc.
>  /opt/local/include/boost
>  /opt/local/var/macports/build/_private_tmp_boost149_boost/boost/work/boost_1_49_0/boost/
>
> I tried modifying this in various ways according to the docs to no avail.
>
> find_package(Boost ${BOOST_VERSION} EXACT
>             COMPONENTS filesystem program_options serialization system
>             REQUIRED)


If I'm not mistaken, the user can give "hints" to FindBoost via the
BOOST_ROOT environment variable.  Regardless of whether a user is
using CMake or not, s/he should be setting this environment variable
anyways.  Take a look at this:

http://www.cmake.org/cmake/help/v3.0/module/FindBoost.html

In particular, the third green-background section on that page.

Ray


More information about the CMake mailing list