May be you're looking for overriding default flags?<div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://www.cmake.org/Wiki/CMake_FAQ#Make_Override_Files">http://www.cmake.org/Wiki/CMake_FAQ#Make_Override_Files</a></div>
<div>Although it mentions VS static runtime, this approach is very useful to set own initial flags in CMake.<br><br><div class="gmail_quote">On Wed, Jul 6, 2011 at 5:41 PM, Jerry Gagelman <span dir="ltr"><<a href="mailto:gagelman@gmail.com">gagelman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I'm redistributing a library for which the original authors have hand coded their own Makefile, but I would like to streamline everything with CMake. Their Makefile provides for Debug and Release flavored configurations, each has its own set of CFLAGS, and for consistency I would like to incorporate the same set of flags.
<div><br></div><div>Using the following commands, the configuration can be selected in the cache:</div><div><br></div><div><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo"><font face="arial, helvetica, sans-serif"><span style="font-size:small">if( DEFINED CMAKE_BUILD_TYPE )</span></font></p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo"><font face="arial, helvetica, sans-serif"><span style="font-size:small">set( CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Options are: Debug Release")</span></font></p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo"><font face="arial, helvetica, sans-serif"><span style="font-size:small">else( DEFINED CMAKE_BUILD_TYPE )</span></font></p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo"><font face="arial, helvetica, sans-serif"><span style="font-size:small">set(CMAKE_BUILD_TYPE Debug CACHE STRING "Options are: Debug Release")</span></font></p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo"><font face="arial, helvetica, sans-serif"><span style="font-size:small">endif( DEFINED CMAKE_BUILD_TYPE )</span></font></p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo"><font face="arial, helvetica, sans-serif"><span style="font-size:small"><br></span></font></p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo">
<font face="arial, helvetica, sans-serif"><span style="font-size:small">That works. Next, I tried to update the C_FLAGS :</span></font></p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo">
<font face="arial, helvetica, sans-serif"><span style="font-size:small"><br></span></font></p><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo"><font face="arial, helvetica, sans-serif"><span style="font-size:small"></span></font></p>
<font face="arial, helvetica, sans-serif"><p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo"><font face="arial, helvetica, sans-serif"><span style="font-size:small">set( CMAKE_C_FLAGS_DEBUG "-Wall -Wno-format -g -DDEBUG</span></font><span style="font-family:arial, helvetica, sans-serif;font-size:small">" CACHE STRING "Recommended debug flags." )</span></p>
<p style="margin:0.0px 0.0px 0.0px 0.0px;font:11.0px Menlo"><font face="arial, helvetica, sans-serif"><span style="font-size:small">set( CMAKE_C_FLAGS_RELEASE "-Wall -Wno-unknown-pragmas -Wno-format -O3" CACHE STRING "Recommended release flags." )</span></font></p>
<div><font face="Menlo" size="3"><span style="font-size:11px"><font face="arial, helvetica, sans-serif"><span style="font-size:small"><br>
</span></font></span></font></div><div>However running "make edit_cache" always reflects the default CMAKE_C_FLAGS_{type}, not the new ones that I supplied. I have tried several variations on this theme, but can't make it work. Before posting a bug report, I thought I'd post this here in case there is anything obvious that I'm missing. </div>
<div><br></div><div>Incidentally, I'm running CMake version 2.8.4, built by MacPorts.</div><div><br></div><div>Thanks,</div><div>Jerry</div></font></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>