Retrieving compile definitions with genex evaluated

I have a build which uses the unifdef tool and hence is dependent on having the compile definitions for built targets available as input to this. Now that I was adding the compile definitions using genexes I’d like to learn a method to retrieve them and have the genexes evaluated. get_target_property gives me them unevaluated.
Is there a canonical way (without reverting to just store all definitions in a list instead)?

By definition, generator expressions (“genexes”) are evaluated at generate time (hence their name), so you cannot access their evaluated value at configure time — it may not even be fully defined yet. You can of course send unevaluated genexes into a context which will eventually evaluate them, such as using them in the arguments of a command run via add_custom_command(). Perhaps something like this:

  OUTPUT result.ext

For more complex situations, you may also want to look at the genexes $<GENEX_EVAL> and $<TARGET_GENEX_EVAL>.

Thanks, I kind of managed to get it to work for unifdef (which can accept a newline separated file with defines) with the following beauty:
But then I realized I need to pass on the definitions to Doxygen as well, which needs a space separated string. So I wonder if there is a way to have this stored in a variable instead of written to disk (and then read up again, and that is when it’s starting to get hard to justify)?

Variables don’t really exist at generate time, so you can’t get the value in a variable. Instead, a $<SPACE> genex (which doesn’t exist yet, but an issue would help) may be useful here as the join string.