Hi guys,

Following the bellow advice, I've been able to locate my boost headers, however even if I supply a direct link to the library (also it is in the standard search path) cmake will not find my library files.

I receive the following message:

  Unable to find the requested Boost libraries.

Boost version: 1.47.0

Boost include path: C:/boost/include/boost-1_47

The following Boost libraries could not be found:

boost_system

boost_filesystem

boost_thread

boost_date_time


My libraries are contained within C:/boost/lib, also copied to c:/boost/include/boost-1_47/boost.

Typical names of my libraries are:

libboost_filesystem-gcc-mt-1_47
and
libboost_filesystem-gcc-mt-1_47

I'm getting really close with this one and so any help is much appreciated (I'm using CMake 2.8.6 by the way).

Many thanks,
Alistair

Date: Tue, 25 Oct 2011 16:54:12 +0100

From: Mateusz ?oskot <mateusz@loskot.net>
To: "Boost.Build developer's and user's list"
       <boost-build@lists.boost.org>
Subject: Re: [Boost-build] Boost Root directory structure for CMAKE
Message-ID:
       <CABUeae-ogfx-fvZK8LCe4bGjLtcrO3URQrQKDJiwBnNXLuRTAQ@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On 25 October 2011 16:26, Alistair Lowe <ali_lowe@sky.com> wrote:
> Hi guys,
>
> I've been building Boost with the following command:
>
> bjam install --prefix=myInstallLoation toolset=gcc-arm target-os=linux
>
> This leaves me with the following directory structure:
> ---------------------------------
> myInstallLocation
>>include
> ? ? ? ?>Boost-1_47
> ? ? ? ? ? ? ? ?>Boost
>>lib
> ---------------------------------
>
> If I tell a CMAKE project that Boost is located at 'myInstallLocation' it's
> unable to find boost.
>
> Does anyone know what directory structure CMAKE is looking for and if
> there's a way to automatically generate files for such a structure?

If you scan your filesystem for FindBoost.cmake and look into this
file, you will find it.
Note, set of paths may be different depending on CMake version (so
version of the FindBoost.cmake module).

Basically, it expects layout like this:

BOOST_ROOT
BOOST_ROOT/boost
BOOST_ROOT/lib

So, you set BOOST_ROOT as include directory, then #include <boost/...> works.
However, the lookup is not that simple, it involves more locations.

Here is what I see in FindBoost.cmake from CMake 2.8 installation:

if(BOOST_ROOT)
set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
 ${BOOST_ROOT}/lib
 ${BOOST_ROOT}/stage/lib)
endif()
set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
 ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}
 ${Boost_INCLUDE_DIR}/lib
 ${Boost_INCLUDE_DIR}/../lib
 ${Boost_INCLUDE_DIR}/stage/lib
)
set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM
 C:/boost/lib
 C:/boost
 "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
 "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib"
 "$ENV{ProgramFiles}/boost/lib"
 "$ENV{ProgramFiles}/boost"
 /sw/local/lib
)

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Member of ACCU, http://accu.org