On Sun, Jan 11, 2009 at 10:00 AM, Wilfried Holzke <span dir="ltr">&lt;<a href="mailto:cmake@holzke.net">cmake@holzke.net</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Hi,<br>
<br>
&gt; cmake -DWITH_DEMO=ON srcdir<br>
&gt;<br>
&gt; in CMakeLists.txt:<br>
&gt;<br>
&gt; if(WITH_DEMO)<br>
&gt; &nbsp; &nbsp;install( demo ....)<br>
&gt; endif(WITH_DEMO)<br>
<br>
</div>If nothing else depends on the demo code I could do<br>
<br>
if(WITH_DEMO)<br>
 &nbsp;add_subdirectory(example)<br>
endif(WITH_DEMO)<br>
<br>
to avoid building the whole source, right?</blockquote><div><br>Yes.&nbsp; The above code will stop CMake from building any targets in the &quot;example&quot; subdirectory.<br><br>You can also use the option() command to specify a default for boolean variables like WITH_DEMO and have it appear as an configurable cache variable when using &quot;ccmake&quot; or &quot;cmake-gui&quot;.<br>
<br>option(WITH_DEMO &quot;Build the examples&quot; OFF)<br>if(WITH_DEMO)<br>
 &nbsp;add_subdirectory(example)<br>
endif(WITH_DEMO)<br><br><br></div></div>-- <br>Philip Lowman<br>