Boost logo

Boost-Build :

Subject: Re: [Boost-build] Different builds for XP and Vista/7
From: Artem Alimarine (brakoziabr_at_[hidden])
Date: 2011-04-13 04:51:23


On 12-4-2011 23:42, Juraj Ivančić wrote:
> This is merely a warning - main target is built correctly. This warning
> is emitted because there is no default target alternative for the
> top-level foo_lib target. You can silence it by adding a dummy default:

The problem is that the library is not built at all:

feature.subfeature target-os windows : flavor : vista xp : composite
optional ;
feature.compose <target-os-windows:flavor>vista :
<define>_WIN32_WINNT=0x0600 ;
feature.compose <target-os-windows:flavor>xp :
<define>_WIN32_WINNT=0x0501 ;
lib foo_lib : foo_xp.cpp : <target-os>windows-xp ;
lib foo_lib : foo_vista.cpp : <target-os>windows-vista ;

Command line:
bjam target-os=windows-xp -d2 foo_lib -a

It reports:
error: No best alternative for ./foo_lib
     next alternative: required properties: <link>static
<runtime-link>static <target-os>windows-xp <threading>multi
         not matched
     next alternative: required properties: <link>static
<runtime-link>static <target-os>windows-vista <threading>multi
         not matched
...found 1 target...

It even does not create the bin directory.

>
> Furthermore - you can also use alias to avoid creating an intermediate
> library:

The reason I use libraries instead of aliases is the following. The real
project consists of many directories with sub-projects/components.
Multiple directories can contain source files with the same name. When
using aliases, I get object files with the same name given to the
linker, which is causes a problem. Using libraries solves this problem.

However, now I have another problem. Some C++ source files are
self-contained components or "plug-ins" that get registered in a static
list of plug-ins by means of static initialization. When such object
file is contained in a library, its static constructors are not called
and the component does not get registered. In this case aliases help.

Artem


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