<div class="gmail_quote">On Sat, Apr 4, 2009 at 2:37 PM, Óscar Fuentes <span dir="ltr">&lt;<a href="mailto:ofv@wanadoo.es">ofv@wanadoo.es</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Philip Lowman &lt;<a href="mailto:philip@yhbt.com">philip@yhbt.com</a>&gt; writes:<br>
</div><div class="im">
&gt; One suggestion would be if you have non-definition flags you want to add to<br>
&gt; every compilation you make, simply use CMAKE_C_FLAGS or CMAKE_CXX_FLAGS.<br>
&gt;<br>
&gt; if(CMAKE_COMPILER_IS_GNU_CC)<br>
&gt;    set(CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS} -Wl,s -save-temps&quot;)<br>
&gt; endif()<br>
<br>
</div>Wouldn&#39;t this conflict with the cache?</blockquote><div><br>Local variables override the cache.  That is to say once you define CMAKE_CXX_FLAGS any references to the variable from that point on are to the local variable unless you unset it.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
&gt; add_definitions() was originally intended for preprocessor definitions<br>
&gt; only.  If you&#39;re using it to non-definition compilation flags I have no idea<br>
&gt; how you&#39;ll be able to pull those out again.<br>
<br>
</div><br>As per my interpretation of the docs, add_definitions is the recommended<br>
way of adding extra compiler options. I may wrong.</blockquote><div><br></div></div>I don&#39;t know what the preferred method is.  I think many people use add_definitions() just because remove_definitions() exists.  I do an add_definitions(-Wall) at my toplevel just because remove_definitions(-Wall) is so much easier to read then string(REPLACE &quot;-Wall&quot; &quot;&quot; CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}).<br>
<br clear="all"><br>-- <br>Philip Lowman<br>