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 class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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 class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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 class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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 class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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 class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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 class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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 class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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 class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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 class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-size: small;"></span></font></p>
<font class="Apple-style-span" face="arial, helvetica, sans-serif"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-size: small;">set( CMAKE_C_FLAGS_DEBUG "-Wall -Wno-format -g -DDEBUG</span></font><span class="Apple-style-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 class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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 class="Apple-style-span" face="Menlo" size="3"><span class="Apple-style-span" style="font-size: 11px;"><font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-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>