Using waf 1.7.9 with extras/boost.py added, I find that you have to get the libraries at configuration time which makes it difficult to build targets with different sets of libraries. For example, I have two programs, one that needs only the header files from boost (program 'a') and another that uses some libraries (program 'b'). Here is my solution, but my question is: Is there a better/preferred way to do this?
#! /usr/bin/env python
# encoding: utf-8
def options(opt):
opt.load('compiler_cxx boost')
def configure(conf):
conf.load('compiler_cxx boost')
conf.check_boost()
conf.env.DEFINES_BOOST = ['NDEBUG']
conf.env.LIB_BOOST_FILESYSTEM = conf.boost_get_libs('filesystem system')[-1]
conf.env.LIB_BOOST_PROGRAM_OPTIONS = conf.boost_get_libs('program_options')[-1]
def build(bld):
# program 'a' requires header-only part of boost
bld.program(
target = 'a',
source = 'a.cpp',
use = ['BOOST'] )
# program 'b' requires link to some boost libraries
bld.program(
target = 'b',
source = 'b.cpp',
use = ['BOOST', 'BOOST_FILESYSTEM', 'BOOST_PROGRAM_OPTIONS'] )