<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hi Joseph,<br><br>On Mon, Jul 21, 2014 at 4:51 PM, Joseph Rosensweig <span dir="ltr"><<a href="mailto:jrosensw@gmail.com" target="_blank">jrosensw@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><span style="font-family:arial,sans-serif;font-size:13px">...</span> <br></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">in my CMAKE I have places where I do things like </span><span style="font-family:arial,sans-serif;font-size:13px">if</span><span style="font-family:arial,sans-serif;font-size:13px">(CMAKE_BUILD_TYPE </span><span style="font-family:arial,sans-serif;font-size:13px">STREQUAL</span><span style="font-family:arial,sans-serif;font-size:13px"> Debug) then do this else do that.</span></div>

</blockquote><div><br>This is the sort of logic best achieved through generator expressions.  How to do it specifically really depends.  Generator expressions are used all over CMake in various different contexts so how to apply them depends on what exactly you are trying to achieve.<br>

<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">i.e. my CXX Flags will change based on the CMAKE_BUILD_TYPE ... What am I missing?</span><br>

</div></blockquote><div><br>This is actually much simpler than the general case.  CMake has specific compiler flags for all builds, release, debug, release with debug info, and minimum size release.  They can be set / ammended with:<br>

<span style="font-family:courier new,monospace"><br></span></div><div><span style="font-family:courier new,monospace"># Flags that get applied to all builds<br></span></div><div><span style="font-family:courier new,monospace">set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /My /EXTRA /COMPILER /FLAGS")<br>

<br></span></div><div><span style="font-family:courier new,monospace"># Flags that only apply to debug builds<br></span></div><div><span style="font-family:courier new,monospace">set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /ADDITIONAL /DEBUG /ONLY /FLAGS")<br>

<br></span><div><span style="font-family:courier new,monospace"># Flags that only apply to release builds<br></span></div><span style="font-family:courier new,monospace">set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /ADDITIONAL /RELEASE /ONLY /FLAGS")</span><br>

<br></div><div>The resulting compiler flags that get used are a combination of the general CMAKE_CXX_FLAGS and CMAKE_CXX_FLAGS for the current selected build configuration.<br></div><br><div>Back to the first issue though, what other types of build-type specific logic are you trying to achieve?  There may be a better / easier way.<br>

</div></div></div></div>