| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Conditions and alternatives</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="linkage.html" title="Static and shared libaries">
- <link rel="next" href="prebuilt.html" title="Prebuilt targets">
- </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="linkage.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="prebuilt.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.conditions"></a>Conditions and alternatives</h2></div></div></div>
- <p>Sometimes, particular relationships need to be maintained
- among a target's build properties. This can be achieved with
- <em class="firstterm">conditional
- requirement</em>. For example, you might want to set
- specific <code class="computeroutput">#defines</code> when a library is built as shared,
- or when a target's <code class="computeroutput">release</code> variant is built in
- release mode.
- </p>
- <pre class="programlisting">
- lib network : network.cpp
- : <span class="bold"><strong><link>shared:<define>NEWORK_LIB_SHARED</strong></span>
- <variant>release:<define>EXTRA_FAST
- ;
- </pre>
- <p>
- In the example above, whenever <code class="filename">network</code> is
- built with <code class="computeroutput"><link>shared</code>,
- <code class="computeroutput"><define>NEWORK_LIB_SHARED</code> will be in its
- properties, too.
- </p>
- <p>
- Sometimes the ways a target is built are so different that
- describing them using conditional requirements would be
- hard. For example, imagine that a library actually uses
- different source files depending on the toolset used to build
- it. We can express this situation using <em class="firstterm">target
- alternatives</em>:
- </p>
- <pre class="programlisting">
- lib demangler : dummy_demangler.cpp ; # alternative 1
- lib demangler : demangler_gcc.cpp : <toolset>gcc ; # alternative 2
- lib demangler : demangler_msvc.cpp : <toolset>msvc ; # alternative 3
- </pre>
- <p>
- In the example above, when built with <code class="literal">gcc</code>
- or <code class="literal">msvc</code>, <code class="filename">demangler</code>
- will use a source file specific to the toolset. Otherwise, it
- will use a generic source file,
- <code class="filename">dummy_demangler.cpp</code>.
- </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="linkage.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="prebuilt.html"><img src="../../images/next.png" alt="Next"></a>
- </div>
- </body>
- </html>
|