Boost logo

Boost-Build :

Subject: Re: [Boost-build] bjam - win/linux
From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2009-12-04 03:03:41

Anant Rao wrote:
> Hi,
> To make OS-specific builds using the same bjam script, I see two ways
> to refer to ThirdParty (TP) lib names and their paths:
> Define every TP lib as TP_WIN_lib and TP_LINUX_lib and refer to the
> OS-specific libs in the Jamfiles as something like this:
> <target-os>linux:<source>TP_LINUX_lib
> <target-os>windows:<source>TP_WIN_lib

Do you mean <source> or <file>? I assume you mean <file> and that you refer
to prebuilt libraries.

> Define only one var (TP_lib) in user-config.jam. So, this would
> obviously differ in the two OS's (say, TP_WIN.lib on Win and
> TP_LINUX.a on Linux). However, the Jamfile just refers to TP_lib.
> The paths could be say, c:\win\dir on Win and /usr/lib/blah on Linux.
> Is option 2 considered better? Is there another option better than
> both?

I don't believe there's any wide consensus on which one is "better". Also,
the answer will vary depending on what the actual libraries are and where
they are located:

- If the third-party libs should be installed into a location outside the
project, I suggest using either site-config.jam or plain environment
variables to define the location (directory) of the thirdparty libs. Then
use this to set up individual targets (references to libraries) in your
jamroot, which all other jamfiles within your project can use.

- If you host the third-party libs inside your project, which I tend to do
whenever reasonable, I'd suggest the first approach. This totally relieves
you from maintaining a separate configuration option (site-config,
user-config, project-config, environment variables).

Also, remember that you might not only be selecting libraries based on OS;
there's also threading, debug/release, compiler brand and other options.

HTH / Johan

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at