Extend file(GENERATE...) to enable the evaluation of $<LINK_ONLY:> generator expressions
We'd like to ask whether it would be possible to relax the restrictions on the fact that $<LINK_ONLY:>
generator expressions can only be outside a linking context.
For our use case we need file(GENERATE)
to write out the contents of the generator expression for future processing by a build time tool.
E.g.:
add_library(Foo ...)
file(GENERATE
OUTPUT ${BINARY_DIR}/out.txt
CONTENTS "$<LINK_ONLY:Foo>"
)
For the example above we need out.txt
to contain Foo
. Currently we run into the following error:
Error evaluating generator expression:
$<LINK_ONLY:Foo>
$<LINK_ONLY:...> may only be used for linking
Perhaps this limitation could be lifted or the file(GENERATE)
command could be extended via an opt-in option to simulate a linking context?