[jamming] [REPOST] Using Jam to link executables with correct library in multiple directories
Kai Backman
kaib at google.com
Tue Aug 22 05:12:51 PDT 2006
Hi Alex,
On 8/22/06, Alex Buell <alex.buell at munted.org.uk> wrote:
> correct libraries, but if I run Jam in base directory, it tries to link
> both sets of executables with -lboost_signals (instead of only linking
> with boost_filesystem in filesystem/ and boost_signals in signals/).
Short answer, you probably want to do this instead of setting LINKFLAGS:
<jam>
for t in $(PROGRAMS)
{
LinkLibraries : $(LIB_SIG) ;
Main $(t) : $(t).cpp ;
}
</jam>
Here is a slightly longer explanation why your original version doesn't work:
This is your top Jamfile:
> SubInclude TOP any ;
> SubInclude TOP assign ;
> SubInclude TOP filesystem ;
> SubInclude TOP signals ;
This is how it actually looks to Jam (paraphrased):
(from $TOP/Jamfile)
SubInclude TOP filesystem ;
(from $TOP/filesystem/Jamfile)
SubDir TOP filesystem ;
LINKFLAGS = -l$(LIB_FS) ;
Main $(t) : $(t).cpp ;
(from $TOP/Jamfile)
SubInclude TOP signals ;
(from $TOP/signals/Jamfile)
SubDir TOP signals ;
LINKFLAGS = -l$(LIB_SIG) ;
Main $(t) : $(t).cpp ;
As you can see, Jam performs textual inclusion of the subdirectories.
Because all actions are carried out in the updating phase (after
parsing is complete) the last value of LINKFLAGS will be used. Because
signals gets included last, that is the setting applied.
Take care,
Kai
--
Kai Backman, Software Engineer, kaib at google.com
More information about the jamming
mailing list