Hello,
This is a simplied case:
add_custom_comand(
COMMAND ls $(echo -l)
VERBATIM
)
In the real case VERBATIM is required because the COMMAND has lots of other arguments that requires it. Because of VERBATIM, the $ is getting escaped. The command becomes
ls $(echo -l) , which does not work as I’m expecting the shell to remplace $(echo -l) with -l.
Suggestions? Thanks.
I would suggest not doing this. This shell command will not work on Windows, and $() rules can differ between Unixes.
If you need to do any complex operations, i would write a separate script to be the command executed - I commonly use either python or cmake scripts for this purpose.
It’s linux only and I have no portability concern. I wanted to avoid writing a separate script because the parsing of the arguments by the original command is non standard and quite messy. I wanted to avoid having to reproduce it. But seems like I will have to do it.
Thanks.