Custom target command only generates command for config referenced in generator expression on Visual Studio
If you do something like:
add_custom_target(tgt COMMAND $<$<CONFIG:Debug>:echo> command that should be echo-ed out in debug builds)
I'd expect it to generate a command like this:
- Debug configuration:
echo command that should be echo-ed out in debug builds
- Non-Debug configurations:
command that should be echo-ed out in debug builds
Instead only the Debug configuration has the expected command. Release, MinSizeRel, and RelWithDebInfo all have empty commands in tgt.vcxproj
. If instead you used $<CONFIG:RelWithDebInfo>
only RelWithDebInfo gets the command.
Implementing #9974 would be better than this hack. Not being able to put spaces in the result of a generator expression also makes it very cumbersome to do the more obvious approach of $<$<CONFIG:Release>:some command /with /arguments>
(trying to wrap it in quotes results in quotes in the command which breaks the command).
I'm using the VS2017 generator with CMake 3.11.1.
Edited by Brad Anderson