Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] find_package and Boost.Cmake
From: David Wolfe (dwolfe_at_[hidden])
Date: 2011-02-22 11:17:41


> I'm trying to figure out how to ensure my build uses my internal version
> of boost. My directory structure looks like:
>
> ./CMakeLists.txt
> ./mylib/CMakeLists.txt
> ./dependencies/boost/...
>
> How do I structure my find_package to use the internal one?

Something like this ought to work, provided you rename your 'boost'
subfolder to something more specific (e.g., boost_1_44_0 or whatever):

   set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/dependencies)
   find_package(Boost REQUIRED
                COMPONENTS
                  thread system program_options date_time random)

I don't like setting CMAKE_PREFIX_PATH from CMakeLists.txt like this
because it prevents people from overriding it on the commandline, but it
may be just what you need. (There may be a 'better' variable to set that
has the same effect, I don't know.)

I'm not sure what the '-mt' suffix is for in your find_package() call,
though. This definitely didn't work for me until I removed the '-mt'
part from all the COMPONENTS. (I think you're supposed to set
Boost_USE_MULTITHREADED to control this, and it defaults to ON[?])

HTH...

On 2/14/2011 9:53 PM, Travis Jensen wrote:
> I'm trying to figure out how to ensure my build uses my internal version
> of boost. My directory structure looks like:
>
> ./CMakeLists.txt
> ./mylib/CMakeLists.txt
> ./dependencies/boost/...
>
> How do I structure my find_package to use the internal one?
>
> I've tried this:
>
> set(BOOST_ROOT "${DEPENDENCY_DIR}/boost")
> find_package( Boost
> COMPONENTS
> thread-mt system-mt program_options-mt date_time-mt
> random-mt
> PATHS ${BOOST_ROOT}
> )
>
> But that gives me the following error:
>
> CMake Error at dependencies/boost/tools/build/CMake/BoostConfig.cmake:98
> (boost_report_pretty):
> Unknown CMake command "boost_report_pretty".
> Call Stack (most recent call first):
> CMakeLists.txt:287 (find_package)
>
> If I don't specify PATHS (even if I specify BOOST_ROOT), it uses the
> boost I have installed on my system.
>
> I can't find any documentation on how to actually use Boost.Cmake. :)
> Help greatly appreciated.
>
> tj
> --
> *Travis Jensen*
> ***
> *Read the Software Maven @ http://softwaremaven.innerbrane.com/
> Read my LinkedIn profile @ http://www.linkedin.com/in/travisjensen
> Read my Twitter mumblings @ http://twitter.com/SoftwareMaven
> Send me email @ travis.jensen_at_[hidden] <mailto:travis.jensen_at_[hidden]>
>
> /*What kind of guy calls himself the Software Maven???*/
>
>
>
> _______________________________________________
> Boost-cmake mailing list
> Boost-cmake_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-cmake


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