I want add_custom_command() to produce a different output depending on whether I'm building for Debug or Release (with a support for Visual Studio multi-configuration builds).
Essentially, I want to achieve something like:
add_custom_command(
OUTPUT $<IF:$<CONFIG:Debug>, file_to_generate_in_debug, file_to_generate_in_release>
COMMAND something.exe
...
)
Unfortunately, the generator expressions are not supported for the OUTPUT argument.
How should I do it using Modern CMake?
To make it more concrete, I'm trying to run windeployqt.exe to and my output should be either Qt5Core.dll or Qt5Cored.dll depending on the actual build configuration (which could either be known at Configure-time (e.g. for Ninja) or at Generate-time (e.g. for Visual Studio)).