<div class="gmail_quote">On Sat, Apr 4, 2009 at 2:37 PM, Óscar Fuentes <span dir="ltr"><<a href="mailto:ofv@wanadoo.es">ofv@wanadoo.es</a>></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 <<a href="mailto:philip@yhbt.com">philip@yhbt.com</a>> writes:<br>
</div><div class="im">
> One suggestion would be if you have non-definition flags you want to add to<br>
> every compilation you make, simply use CMAKE_C_FLAGS or CMAKE_CXX_FLAGS.<br>
><br>
> if(CMAKE_COMPILER_IS_GNU_CC)<br>
> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,s -save-temps")<br>
> endif()<br>
<br>
</div>Wouldn'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">
> add_definitions() was originally intended for preprocessor definitions<br>
> only. If you're using it to non-definition compilation flags I have no idea<br>
> how you'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'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 "-Wall" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}).<br>
<br clear="all"><br>-- <br>Philip Lowman<br>