The current CMake 2.8.0 system does not allow custom commands created
with add_custom_command() to do different things based on the build
configuration.<br>
<br>
I propose adding a new keyword to the add_custom_command CMake directive called CONFIG:<br>
<br>
add_custom_command(OUTPUT output1 [output2 ...]<br>
   COMMAND command1 [ARGS] [args1...]<br>
   [COMMAND command2 [ARGS] [args2...] ...]<br>
   [MAIN_DEPENDENCY depend]<br>
   [DEPENDS [depends...]]<br>
   [IMPLICIT_DEPENDS &lt;lang1&gt; depend1 ...]<br>
   [WORKING_DIRECTORY dir]<br>
   [COMMENT comment] [VERBATIM] [APPEND]<br>
   [CONFIG Debug | MinSizeRel | Release | RelWithDebInfo | ...])<br>
<br>
add_custom_command(TARGET target<br>
   PRE_BUILD | PRE_LINK | POST_BUILD<br>
   COMMAND command1 [ARGS] [args1...]<br>
   [COMMAND command2 [ARGS] [args2...] ...]<br>
   [WORKING_DIRECTORY dir]<br>
   [COMMENT comment] [VERBATIM]<br>
   [CONFIG Debug | MinSizeRel | Release | RelWithDebInfo | ...])<br>
<br>
The CONFIG option specifies that the custom command(s) should run only
when the given build configuration is active. This option allows custom
commands to have configuration specific behavior.<br>
<br>
When the CONFIG option is not present, add_custom_command behaves as before.<br><br>I have reported this issue(9974) in the Mantis database and provided patches that implement this change.  <br><br>Thanks,<br><br>Steve<br>