Boost logo

Boost-Build :

From: John Eivind Helset (jehelset_at_[hidden])
Date: 2020-10-28 10:58:14


I use <tag> (
https://boostorg.github.io/build/manual/develop/index.html#bbv2.builtin.features.tag)
for this:

rule my-condition ( name : type ? : properties * )
{
  local ver = [ $(properties).get <my-version> ] ;
  local my-lib = [ SPLIT_BY_CHARACTERS $(ver) : "." ] ;
  if $(type) in STATIC_LIB SHARED_LIB EXE
  {
    return $(name)$(my-lib:J) ;
  }
  return ;
}
lib xxx : : <tag>@my-condition ;

regards jeh

On Wed, 28 Oct 2020 at 10:51, Arvid Norberg via Boost-build <
boost-build_at_[hidden]> wrote:

> Hi. I'm having an issue I haven't been able to pin-point where it goes
> wrong. I want to declare a lib rule that refers to a pre-built library.
> Typically this is done in this form:
>
> lib foobar : : <search>/my/library/path <name>library-name ;
>
> However, I want the <name> to be computed by some more sophisticated
> logic. To do this, I define a rule ("my-condition") and I replace
> "<name>library-name" with "<conditional>@my-condition".
>
> Here's a complete reproducer Jamfile:
>
> import feature : feature ;
> feature my-version : : free ;
>
> rule my-condition ( properties * )
> {
> local ver = [ feature.get-values <my-version> : $(properties) ] ;
> local my-lib = "foobar" [ SPLIT_BY_CHARACTERS $(ver) : "." ] ;
> return <name>$(my-lib:J) ;
> }
>
> lib foobar : : <conditional>@my-condition ;
>
> The rule my-condition produces a name of "foobar123", if <my-version>1.2.3
> is set.
> Running b2 produces the following error:
>
> $ b2 my-version=1.2.3
>
> boost_1_73_0/tools/build/src/kernel/class.jam:90: in new
> *** argument error
> * rule class_at_searched-lib-target.__init__ ( name : project : shared ? :
> search * : action )
> * called with: ( foobar foobar123 : object(project-target)@209 : true : :
> object(null-action)@228 : : : : : : : : : : : : : : )
> * extra argument foobar123
> boost_1_73_0/tools/build/src/tools/generators/searched-lib-generator.jam:70:see
> definition of rule 'class_at_searched-lib-target.__init__' being called
> boost_1_73_0/tools/build/src/tools/generators/searched-lib-generator.jam:48:
> in searched-lib-generator.run
> boost_1_73_0/tools/build/src/tools/unix.jam:113: in
> class_at_unix-searched-lib-generator.run
> boost_1_73_0/tools/build/src/build/generators.jam:1019: in
> try-one-generator-really
> boost_1_73_0/tools/build/src/build/generators.jam:1081: in
> try-one-generator
> boost_1_73_0/tools/build/src/build/generators.jam:1319: in construct-really
> boost_1_73_0/tools/build/src/build/generators.jam:1405: in
> generators.construct
> boost_1_73_0/tools/build/src/tools/generators/lib-generator.jam:59: in
> class_at_lib-generator.run
> boost_1_73_0/tools/build/src/build/generators.jam:1019: in
> try-one-generator-really
> boost_1_73_0/tools/build/src/build/generators.jam:1081: in
> try-one-generator
> boost_1_73_0/tools/build/src/build/generators.jam:1319: in construct-really
> boost_1_73_0/tools/build/src/build/generators.jam:1405: in
> generators.construct
> boost_1_73_0/tools/build/src/build/targets.jam:1615: in construct
> boost_1_73_0/tools/build/src/build/targets.jam:1364: in
> class_at_basic-target.generate
> boost_1_73_0/tools/build/src/build/targets.jam:812: in generate-really
> boost_1_73_0/tools/build/src/build/targets.jam:784: in
> class_at_main-target.generate
> boost_1_73_0/tools/build/src/build/targets.jam:273: in
> class_at_project-target.generate
> boost_1_73_0/tools/build/src/build-system.jam:797: in load
> boost_1_73_0/tools/build/src/kernel/modules.jam:295: in import
> boost_1_73_0/tools/build/src/kernel/bootstrap.jam:139: in boost-build
> boost_1_73_0/tools/build/boost-build.jam:8: in module scope
>
> It's as if the <name> feature somehow is interpreted as the name of the
> lib rule, rather than a feature that's part of its properties.
>
> --
> Arvid Norberg
> _______________________________________________
> Unsubscribe & other changes:
> https://lists.boost.org/mailman/listinfo.cgi/boost-build
>



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