1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>How to change compilation flags for one file?
</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="../../index.html" title="PartI.Boost.Build v2 User Manual">
<link rel="up" href="../faq.html" title="Chapter7.Frequently Asked Questions">
<link rel="prev" href="s07.html" title="How to get the project-root location?
">
<link rel="next" href="dll-path.html" title="Why are the dll-path and
hardcode-dll-paths properties useful?
">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="s07.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../faq.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="dll-path.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="id2580291"></a>How to change compilation flags for one file?
</h2></div></div></div>
<p>If one file must be compiled with special options, you need to
explicitly declare an <code class="computeroutput">obj</code> target for that file and then use
that target in your <code class="computeroutput">exe</code> or <code class="computeroutput">lib</code> target:
</p>
<pre class="programlisting">
exe a : a.cpp b ;
obj b : b.cpp : <optimization>off ;
</pre>
<p>
Of course you can use other properties, for example to specify specific
compiler options:
</p>
<pre class="programlisting">
exe a : a.cpp b ;
obj b : b.cpp : <cflags>-g ;
</pre>
<p>
You can also use <a href="../tutorial/conditions.html" title="Conditions and alternatives">conditional
properties</a> for finer control:
</p>
<pre class="programlisting">
exe a : a.cpp b ;
obj b : b.cpp : <variant>release:<optimization>off ;
</pre>
<p>
</p>
</div>
<table width="100%"><tr>
<td align="left"></td>
<td align="right"><small></small></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="s07.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../faq.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="dll-path.html"><img src="../../images/next.png" alt="Next"></a>
</div>
</body>
</html>
|