Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2001-08-16 06:48:42


Dave,

What's the correct way of added system libs that need to be linked to an
exe (eventually on a platform specific basis?). As a starting point the
regex sample programs need user32.lib with msvc, so I tried:

exe timer : timer/regex_timer.cpp
   <lib>../build/libboost_regex$(SUFLIB)
        :
                <include>$(BOOST_ROOT)
                <define>BOOST_RE_NO_LIB=1
                <msvc><*><find-library>user32.lib
        :
                debug
      <runtime-link>dynamic
        ;

but then I get messages about not being able to find user32.lib: this looks
plain wrong - system libs could be in one of any number of places and have
any number of file extentions (.lib .a .so .sl etc) so jam shouldn't be
looking for these to exist. Anyway I then changed to :

NOCARE user32.lib ;

exe timer : timer/regex_timer.cpp
   <lib>../build/libboost_regex$(SUFLIB)
        :
                <include>$(BOOST_ROOT)
                <define>BOOST_RE_NO_LIB=1
                <msvc><*><find-library>user32.lib
        :
                debug
      <runtime-link>dynamic
        ;

which at least tries to link, but still fails, because user32.lib does not
get added to the command line! What's going on here? I tried
<library-file> as well with the same results.

/footnote:
There is a better way of fixing this in this specific case (adding a
#pragma comment to the regex code that relies upon user32.lib so it gets
linked automatically), but there are other cases that will occur: on some
platforms regex will need -lpthread, others will need -lm or whatever, so
this needs to work...
/ footnote.

- John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk