| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Prebuilt targets</title>
- <link rel="stylesheet" href="../../boostbook.css" type="text/css">
- <meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
- <style type="text/css">
- body { background-image: url('http://docbook.sourceforge.net/release/images/draft.png');
- background-repeat: no-repeat;
- background-position: top left;
- /* The following properties make the watermark "fixed" on the page. */
- /* I think that's just a bit too distracting for the reader... */
- /* background-attachment: fixed; */
- /* background-position: center center; */
- }</style>
- <link rel="start" href="../../index.html" title="The Boost C++ Libraries">
- <link rel="up" href="../tutorial.html" title="Chapter 23. Tutorial">
- <link rel="prev" href="conditions.html" title="Conditions and alternatives">
- <link rel="next" href="../advanced.html" title="Chapter 24. User documentation">
- </head>
- <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
- <table cellpadding="2" width="100%">
- <td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../../../boost.png"></td>
- <td align="center"><a href="../../../../index.htm">Home</a></td>
- <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
- <td align="center"><a href="../../../../people/people.htm">People</a></td>
- <td align="center"><a href="../../../../more/faq.htm">FAQ</a></td>
- <td align="center"><a href="../../../../more/index.htm">More</a></td>
- </table>
- <hr>
- <div class="spirit-nav">
- <a accesskey="p" href="conditions.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../advanced.html"><img src="../../images/next.png" alt="Next"></a>
- </div>
- <div class="section" lang="en">
- <div class="titlepage"><div><div><h2 class="title" style="clear: both">
- <a name="bbv2.tutorial.prebuilt"></a>Prebuilt targets</h2></div></div></div>
- <p>
- To link to libraries whose build instructions aren't given in a Jamfile,
- you need to create <code class="computeroutput">lib</code> targets with an appropriate
- <code class="varname">file</code> property. Target alternatives can be used to
- associate multiple library files with a single conceptual target. For
- example:
- </p>
- <pre class="programlisting">
- # util/lib2/Jamfile
- lib lib2
- :
- : <file>lib2_release.a <variant>release
- ;
- lib lib2
- :
- : <file>lib2_debug.a <variant>debug
- ;
- </pre>
- <p>
- This example defines two alternatives for <code class="filename">lib2</code>, and
- for each one names a prebuilt file. Naturally, there are no sources.
- Instead, the <code class="varname"><file></code> feature is used to specify
- the file name.
- </p>
- <p>
- Once a prebuilt target has been declared, it can be used just like any other target:
- </p>
- <pre class="programlisting">
- exe app : app.cpp ../util/lib2//lib2 ;
- </pre>
- <p>
- As with any target, the alternative selected depends on the
- properties propagated from <code class="filename">lib2</code>'s dependents.
- If we build the the release and debug versions of <code class="filename">app</code> will be linked
- with <code class="filename">lib2_release.a</code> and <code class="filename">lib2_debug.a</code>, respectively.
- </p>
- <p>
- System libraries—those that are automatically found by
- the toolset by searching through some set of predetermined
- paths—should be declared almost like regular ones:
- </p>
- <pre class="programlisting">
- lib pythonlib : : <name>python22 ;
- </pre>
- <p>
- We again don't specify any sources, but give a
- <code class="varname">name</code> that should be passed to the
- compiler. If the gcc toolset were used to link an executable
- target to <code class="filename">pythonlib</code>, <code class="option">-lpython22</code>
- would appear in the command line (other compilers may use
- different options).
- </p>
- <p>
- We can also specify where the toolset should look for the library:
- </p>
- <pre class="programlisting">
- lib pythonlib : : <name>python22 <search>/opt/lib ;
- </pre>
- <p>
- And, of course, target alternatives can be used in the usual way:
- </p>
- <pre class="programlisting">
- lib pythonlib : : <name>python22 <variant>release ;
- lib pythonlib : : <name>python22_d <variant>debug ;
- </pre>
- <p>A more advanced use of prebuilt targets is described in <a href="../recipies/site-config.html" title="Targets in site-config.jam">the section called “Targets in site-config.jam”</a>.
- </p>
- </div>
- <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
- <td align="left"></td>
- <td align="right"><small></small></td>
- </tr></table>
- <hr>
- <div class="spirit-nav">
- <a accesskey="p" href="conditions.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../advanced.html"><img src="../../images/next.png" alt="Next"></a>
- </div>
- </body>
- </html>
|