Backport lots of new features from the 1.41.0 branch.
[boost:cmake.git] / tools / build / CMake / docs / build / html / individual_libraries.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4 <html xmlns="http://www.w3.org/1999/xhtml">
5   <head>
6     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7     
8     <title>Building individual libraries with cmake &mdash; Boost.CMake 1.40.0.cmake5</title>
9     <link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
10     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
11     <script type="text/javascript">
12       var DOCUMENTATION_OPTIONS = {
13         URL_ROOT:    '',
14         VERSION:     '1.40.0.cmake5',
15         COLLAPSE_MODINDEX: false,
16         FILE_SUFFIX: '.html',
17         HAS_SOURCE:  true
18       };
19     </script>
20     <script type="text/javascript" src="_static/jquery.js"></script>
21     <script type="text/javascript" src="_static/doctools.js"></script>
22     <link rel="top" title="Boost.CMake 1.40.0.cmake5" href="index.html" />
23     <link rel="next" title="Adding a Library Project" href="add_boost_library.html" />
24     <link rel="prev" title="Testing" href="testing.html" /> 
25   </head>
26   <body>
27     <div class="related">
28       <h3>Navigation</h3>
29       <ul>
30         <li class="right" style="margin-right: 10px">
31           <a href="genindex.html" title="General Index"
32              accesskey="I">index</a></li>
33         <li class="right" >
34           <a href="add_boost_library.html" title="Adding a Library Project"
35              accesskey="N">next</a> |</li>
36         <li class="right" >
37           <a href="testing.html" title="Testing"
38              accesskey="P">previous</a> |</li>
39     <li><a href="http://www.boost.org/">Boost</a> &raquo;</li>
40     
41         <li><a href="index.html">Boost.CMake 1.40.0.cmake5</a> &raquo;</li>
42  
43       </ul>
44     </div>
45       <div class="sphinxsidebar">
46         <div class="sphinxsidebarwrapper">
47             <p class="logo"><a href="index.html">
48               <img class="logo" src="_static/boost-small.png" alt="Logo"/>
49             </a></p>
50             <h3><a href="index.html">Table Of Contents</a></h3>
51             <ul>
52 <li><a class="reference external" href="">Building individual libraries with cmake</a><ul>
53 <li><a class="reference external" href="#preprocessing">Preprocessing</a></li>
54 <li><a class="reference external" href="#tests-and-examples">Tests and examples</a></li>
55 <li><a class="reference external" href="#building-individual-targets-ignoring-prerequisites">Building individual targets, ignoring prerequisites</a></li>
56 </ul>
57 </li>
58 </ul>
59
60             <h4>Previous topic</h4>
61             <p class="topless"><a href="testing.html"
62                                   title="previous chapter">Testing</a></p>
63             <h4>Next topic</h4>
64             <p class="topless"><a href="add_boost_library.html"
65                                   title="next chapter">Adding a Library Project</a></p>
66             <h3>This Page</h3>
67             <ul class="this-page-menu">
68               <li><a href="_sources/individual_libraries.txt"
69                      rel="nofollow">Show Source</a></li>
70             </ul>
71         </div>
72       </div>
73
74     <div class="document">
75       <div class="documentwrapper">
76         <div class="bodywrapper">
77           <div class="body">
78             
79   <div class="section" id="building-individual-libraries-with-cmake">
80 <h1>Building individual libraries with cmake<a class="headerlink" href="#building-individual-libraries-with-cmake" title="Permalink to this headline">¶</a></h1>
81 <p>In a configured cmake workspace, <tt class="docutils literal"><span class="pre">make</span> <span class="pre">help</span></tt> will display a list of available targets.  Example:</p>
82 <div class="highlight-python"><pre>% make help
83 The following are some of the valid targets for this Makefile:
84 ... all (the default if no target is provided)
85 ... clean
86 ... depend
87 ... edit_cache
88 ... install
89 ... install/local
90 ... install/strip
91 ... list_install_components
92 ... package
93 ... package_source
94 ... rebuild_cache
95 ... boost_date_time
96 ... boost_date_time-mt-shared
97 ... boost_date_time-mt-shared-debug
98 ... boost_date_time-mt-static
99 ... boost_date_time-mt-static-debug
100 ... boost_date_time-shared
101 ... boost_date_time-shared-debug
102 ... boost_date_time-static
103 ... boost_date_time-static-debug
104 ... boost_filesystem
105 ... boost_filesystem-mt-shared
106 ... boost_filesystem-mt-shared-debug
107 ... boost_filesystem-mt-static
108 ... boost_filesystem-mt-static-debug
109 ... boost_filesystem-shared
110 ... boost_filesystem-shared-debug
111 ... boost_filesystem-static
112 ... boost_filesystem-static-debug
113 [etc]</pre>
114 </div>
115 <p>You can build any target by passing it as an argument:</p>
116 <div class="highlight-python"><pre>% make boost_signals-static
117 [  0%] Building CXX object libs/signals/src/CMakeFiles/boost_signals-static.dir/trackable.cpp.o
118 [  0%] Building CXX object libs/signals/src/CMakeFiles/boost_signals-static.dir/connection.cpp.o
119 [100%] Building CXX object libs/signals/src/CMakeFiles/boost_signals-static.dir/named_slot_map.cpp.o
120 [100%] Building CXX object libs/signals/src/CMakeFiles/boost_signals-static.dir/signal_base.cpp.o
121 [100%] Building CXX object libs/signals/src/CMakeFiles/boost_signals-static.dir/slot.cpp.o
122 Linking CXX static library ../../../lib/libboost_signals-gcc41-1_35.a
123 [100%] Built target boost_signals-static</pre>
124 </div>
125 <div class="section" id="preprocessing">
126 <h2>Preprocessing<a class="headerlink" href="#preprocessing" title="Permalink to this headline">¶</a></h2>
127 <p>In build directories corresponding to a source library containing a
128 <tt class="docutils literal"><span class="pre">CMakeLists.txt</span></tt> containing a <tt class="docutils literal"><span class="pre">boost_add_library</span></tt> invocation
129 (e.g. <tt class="docutils literal"><span class="pre">build/libs/signals/src,</span> <span class="pre">build/libs/filesystem/src</span></tt>), more
130 detailed targets are available:</p>
131 <div class="highlight-python"><pre>% cd libs/signals/src
132 % make help
133 The following are some of the valid targets for this Makefile:
134   [many omitted]
135 ... signal_base.o
136 ... signal_base.i
137 ... signal_base.s
138 ... slot.o
139 ... slot.i
140 ... slot.s</pre>
141 </div>
142 <p>making <tt class="docutils literal"><span class="pre">slot.i</span></tt> will run <tt class="docutils literal"><span class="pre">slot.cpp</span></tt> through the preprocessor:</p>
143 <div class="highlight-python"><pre>% make slot.i
144 Preprocessing CXX source to CMakeFiles/boost_signals-mt-shared.dir/slot.cpp.i</pre>
145 </div>
146 <p>If you are always interested in seeing the compiler flags you can
147 enable <tt class="docutils literal"><span class="pre">CMAKE_VERBOSE_MAKEFILES</span></tt> via <tt class="docutils literal"><span class="pre">ccmake</span></tt>, or for a one-off
148 just pass <tt class="docutils literal"><span class="pre">VERBOSE=1</span></tt> on the command line:</p>
149 <div class="highlight-python"><pre>% make VERBOSE=1 slot.i
150 make[1]: Entering directory `/home/troy/Projects/boost/branches/CMake/Boost_1_35_0-build'
151 Preprocessing CXX source to CMakeFiles/boost_signals-mt-shared.dir/slot.cpp.i
152 cd /home/troy/Projects/boost/branches/CMake/Boost_1_35_0-build/libs/signals/src &amp;&amp; /usr/bin/gcc-4.1
153 -DBOOST_ALL_NO_LIB=1 -DBOOST_SIGNALS_NO_LIB=1 -Dboost_signals_mt_shared_EXPORTS -fPIC
154 -I/home/troy/Projects/boost/branches/CMake/Boost_1_35_0     -O3 -DNDEBUG -DBOOST_SIGNALS_DYN_LINK=1
155 -pthread -D_REENTRANT -E /home/troy/Projects/boost/branches/CMake/Boost_1_35_0/libs/signals/src/slot.cpp &gt; CMakeFiles/boost_signals-mt-shared.dir/slot.cpp.i</pre>
156 </div>
157 </div>
158 <div class="section" id="tests-and-examples">
159 <h2>Tests and examples<a class="headerlink" href="#tests-and-examples" title="Permalink to this headline">¶</a></h2>
160 <p>Tests and examples are typically grouped into subdirectories, e.g.:</p>
161 <div class="highlight-python"><pre>libs/
162   iostreams/
163     test/
164     examples/</pre>
165 </div>
166 <p>CMake builds a parallel directory hierarchy in the build directory. If
167 you are working on, say, the examples for iostreams, you can just
168 <tt class="docutils literal"><span class="pre">cd</span></tt> into the directory $BUILDDIR/libs/iostreams/examples and type
169 <tt class="docutils literal"><span class="pre">make</span></tt>:</p>
170 <div class="highlight-python"><pre>% cd libs/iostreams/example
171 % make
172 [  0%] Built target boost_iostreams-mt-static
173 Scanning dependencies of target iostreams-examples-boost_back_inserter_example
174 [  0%] Building CXX object libs/iostreams/example/CMakeFiles/iostreams-examples-boost_back_inserter_example.dir/boost_back_inserter_example.cpp.o
175 Linking CXX executable ../../../bin/iostreams-examples-boost_back_inserter_example
176 [  0%] Built target iostreams-examples-boost_back_inserter_example
177 Scanning dependencies of target iostreams-examples-container_device_example
178 [  0%] Building CXX object libs/iostreams/example/CMakeFiles/iostreams-examples-container_device_example.dir/container_device_example.cpp.o
179 Linking CXX executable ../../../bin/iostreams-examples-container_device_example
180 [  0%] Built target iostreams-examples-container_device_example
181 Scanning dependencies of target iostreams-examples-container_sink_example
182 [  0%] Building CXX object libs/iostreams/example/CMakeFiles/iostreams-examples-container_sink_example.dir/container_sink_example.cpp.o</pre>
183 </div>
184 </div>
185 <div class="section" id="building-individual-targets-ignoring-prerequisites">
186 <h2>Building individual targets, ignoring prerequisites<a class="headerlink" href="#building-individual-targets-ignoring-prerequisites" title="Permalink to this headline">¶</a></h2>
187 <p>If you find yourself working on a compiler error in a file that takes
188 a long time to compile, waiting for make to check all of the
189 prerequisites might become tedious.  You can have make skip the
190 prerequisite testing (you do this at your own risk), by appending
191 <tt class="docutils literal"><span class="pre">/fast</span></tt> to the target name.  For instance, bcp depends on the
192 <tt class="docutils literal"><span class="pre">system</span></tt>, <tt class="docutils literal"><span class="pre">filesystem</span></tt> <tt class="docutils literal"><span class="pre">regex</span></tt> and <tt class="docutils literal"><span class="pre">prg_exec_monitor</span></tt>
193 libraries:</p>
194 <div class="highlight-python"><pre>% cd tools/bcp
195 % make bcp
196 [  0%] Built target boost_system-mt-static
197 [  0%] Built target boost_filesystem-mt-static
198 [ 50%] Built target boost_regex-mt-static
199 [ 75%] Built target boost_prg_exec_monitor-mt-static
200 [ 75%] Building CXX object tools/bcp/CMakeFiles/bcp.dir/add_path.cpp.o</pre>
201 </div>
202 <p>if I make <tt class="docutils literal"><span class="pre">bcp/fast</span></tt>, the dependencies are assumed to be built
203 already:</p>
204 <div class="highlight-python"><pre>% make bcp/fast
205 [ 75%] Building CXX object tools/bcp/CMakeFiles/bcp.dir/add_path.cpp.o
206 [ 75%] Building CXX object tools/bcp/CMakeFiles/bcp.dir/bcp_imp.cpp.o
207 (etc)</pre>
208 </div>
209 </div>
210 </div>
211
212
213           </div>
214         </div>
215       </div>
216       <div class="clearer"></div>
217     </div>
218     <div class="related">
219       <h3>Navigation</h3>
220       <ul>
221         <li class="right" style="margin-right: 10px">
222           <a href="genindex.html" title="General Index"
223              >index</a></li>
224         <li class="right" >
225           <a href="add_boost_library.html" title="Adding a Library Project"
226              >next</a> |</li>
227         <li class="right" >
228           <a href="testing.html" title="Testing"
229              >previous</a> |</li>
230     <li><a href="http://www.boost.org/">Boost</a> &raquo;</li>
231     
232         <li><a href="index.html">Boost.CMake 1.40.0.cmake5</a> &raquo;</li>
233  
234       </ul>
235     </div>
236     <div class="footer">
237       &copy; Copyright 2008-2009, Troy D. Straszheim, 2008 Douglas Gregor --  Version 31c30425cf29d2ae048ffb07c8284cee1e095b7a, Mon, 26 Oct 2009.
238       Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2.
239     </div>
240   </body>
241 </html>