Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] Building boost "with an uninstalled build" and linking to boost libs
From: Gavin Heavyside (gavin.heavyside_at_[hidden])
Date: 2010-03-24 16:01:22


On 24 March 2010 14:31, Brian Davis <bitminer_at_[hidden]> wrote:
>
>
> I am currently trying the boost "With an uninstalled build" variety:
>

I've had good success using the Boost "in a subdirectory" recipe,
which builds only the parts I need. This is on linux/mac with gcc and
make, so YMMV, but I think the relevant parts of my CMake file are:

# Variables to configure how boost is built
# If we need more libraries add them to the BUILD_PROJECTS variable
set(BUILD_TESTS 0 CACHE INTERNAL "")
set(ENABLE_SHARED 1 CACHE INTERNAL "")
set(ENABLE_STATIC 1 CACHE INTERNAL "")
<set a few more config options>
set(BUILD_PROJECTS date_time program_options filesystem system regex
CACHE INTERNAL "")
...
# Exclude boost libs from the all target, they will be built
# as dependencies of other targets that require them.
add_subdirectory(vendor/boost/boost EXCLUDE_FROM_ALL)
...
include_directories(${project_SOURCE_DIR}/vendor/boost/boost)
...

In my subprojects' CMakeLists.txt files, I then add dependent
libraries as required:
target_link_libraries(target_name boost_program_options-static
boost_regex-static)

This seems to work well for me.

Gavin


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