<br><div class="gmail_quote">On 16 June 2011 15:45, Michael Hertling <span dir="ltr"><<a href="mailto:mhertling@online.de">mhertling@online.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div>IMO, the default should not need to be explicitly enabled but the<br></div>
exception, and readability - though important - is subordinate to<br>
functionality, but probably, this is a matter of personal taste.<br>
<br>
However, if you stick with the GEN_OUTFILES definition, be aware of<br>
the single-config generator with an empty build type. In that case,<br>
only the COMPILE_DEFINITIONS property is in effect, so you must add<br>
the GEN_OUTFILES definition to it, but with a non-empty build type,<br>
this config-less property is in effect, too, so you must *not* add<br>
GEN_OUTFILE to it. Thus, you need to differentiate these cases:<br>
<br>
IF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)<br>
FOREACH(... IN LISTS ... ITEMS ...)<br>
# Set COMPILE_DEFINITIONS_<CONFIG>.<br>
ENDFOREACH()<br>
ELSE()<br>
# Set COMPILE_DEFINITIONS.<br>
ENDIF()<br>
<br>
Clearly, this cuts down the elegance of the FOREACH loop, while the<br>
inverted approach with NO_GEN_OUTFILES would be unalteredly smooth.<br></blockquote><div> <br>Luckily I already have this in my CMakeLists.txt:<br><br>if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)<br> set(CMAKE_BUILD_TYPE Release)<br>
endif()<br><br>to force the default build to use the Release configuration. Otherwise I would have fallen foul of the case you are suggesting.<br><br>Is COMPILE_DEFINITIONS only used in single-config generators if CMAKE_BUILD_TYPE is not set ? That might explain why my initial attempts to do this failed. I had added GEN_OUTFILES to COMPILE_DEFINITIONS thinking this would apply to all configs. And then when I tried to remove that option from COMPILE_DEFINITIONS_RELEASENOOUTFILES it failed to have the desired effect. <br>
<br>Would that approach have worked for the multi-config generators ? Do they use the concatenation of
COMPILE_DEFINITIONS and COMPILE_DEFINITIONS_<active config> ? <br><br>--<br>Glenn<br><br></div></div>