Boost logo

Boost-Build :

Subject: Re: [Boost-build] Question: windows static library that uses a dll.
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-09-12 13:47:36


AMDG

On 09/12/2012 05:59 AM, Juan Carlos Franzoy wrote:
>
> This solution would duplicate all the targets which depends on A or B.
> Is there any way of including conditionally some sources (A or AS, B or BS
> for instance) in a target? or any other way to reduce verbosity?
> Is there any way of doing defining only one target for library A?
>

# Mangle the library and executable names
rule tag ( name : type ? : property-set )
{
  if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB EXE &&
    [ $(property-set).get <link> ] == static &&
    ! [ $(property-set).get <shared-a> ]
  {
    return $(name)S ;
  }
}
project : requirements <tag>@tag ;

# library A
lib A : ... : <link>shared:<define>A_DYN_LINK : :
  <link>shared:<define>A_DYN_LINK ;

# Force a separate subdirectory for B
feature.feature shared-a : on : optional ;

# Targets for B and BS
lib B.lib : ... A/<link>shared : <link>static <shared-a>on ;
lib B.lib-s : ... A/<link>static : <link>static ;
# Target alternative to select the correct version of B
alias B : B.lib : <link>shared ;
alias B : B.lib-s : <link>static ;

exe C : B ;

In Christ,
Steven Watanabe


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