Boost logo

Boost-Build :

Subject: Re: [Boost-build] Boost Root directory structure for CMAKE
From: Mateusz Łoskot (mateusz_at_[hidden])
Date: 2011-10-25 11:54:12


On 25 October 2011 16:26, Alistair Lowe <ali_lowe_at_[hidden]> 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

Boost-Build 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