2

I was trying to use a CMake Generator Expression such as:

 $<TARGET_GENEX_EVAL:foo,$<TARGET_PROPERTY:$<TARGET_NAME_IF_EXISTS:foo>,PROP_BAR>>

This expression works fine when the Generator used is Visual Studio or Unix Makefiles but fails when the generator used is Ninja with errors such as:

CMake Error at cmake/<fname>.cmake:629 (add_custom_command):
  Error evaluating generator expression:

$<TARGET_GENEX_EVAL:foo,$<TARGET_PROPERTY:$<TARGET_NAME_IF_EXISTS:foo>,PROP_BAR>>

  Expression did not evaluate to a known generator expression
Call Stack (most recent call first):
  cmake/<fname>.cmake:1269
  <target>/CMakeLists.txt:16

Does Ninja not support Generator Expressions?

If it doesn't what are my best options?

If it does, what exactly is the issue?

einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • Can you show the whole `add_custom_command`? – KamilCuk Jun 08 '20 at 07:34
  • @KamilCuk it is something along the lines, ```add_custom_command(OUTPUT ${dictionary}.cxx ${arg1} ${arg2} ${arg3} COMMAND ${command} -v2 -f ${dictionary}.cxx ${arg4} ... more args)``` – gargvaibhav64 Jun 08 '20 at 08:09
  • arg4 here is set using the generator expression I mentioned above.Also, the same command works fine if generator is Unix Makefiles/ Visual Studio – gargvaibhav64 Jun 08 '20 at 08:12

0 Answers0