Hello.

As part of a project, I have a library with an associated Jamfile I need to build. I want to build this particular library as a static lib, so I've added <link>static to the project requirements in the Jamfile for the library. So far so good.

However, I also want to exclude a particular source file from the library if I use a particular toolset (gcc in this case). So I've created two targets; one with all the sources and no particular requirements, and one without the source file in question with <toolset>gcc added as a requirement, like so:



project A
  : requirements
    <link>static
    <toolset>gcc:<cxxflags>-DNO_SMART
  : usage-requirements
    <linkflags>-lA
    <include>.
  ;

alias commonsources
  :  (snip)
  ;

lib libA
  : commonsources
    SOURCE.cpp
  ;

lib libA
  : commonsources
  : <toolset>gcc
  ;

The problem is that when building with a toolset that is not gcc, bjam fails to find an appropriate target. The output it gives me is as follows:
error: No best alternative for ./libA
    next alternative: required properties: <link>static
        not matched
    next alternative: required properties: <link>static <toolset>gcc
        not matched

Obviously, I want the builds to match the closest possible alternative; that is, any build with a toolset other than gcc should match the first target, and any build with gcc as a toolset should match the second target.

Is there a way to achieve this, or perhaps a different way altoghether to exclude source files from a target when build with a particular toolset?