[cmake-developers] add_custom_command() OUTPUT does not accept generator expressions, why?
Dan Liew
dan at su-root.co.uk
Sun Mar 27 06:11:44 EDT 2016
Hi,
I tried writing a add_custom_command statement that will output the
generated file into the same directory as another target
```
set(OUTPUT_NAME "$<TARGET_FILE_DIR:foo>/MyThing.dll")
add_custom_command(OUTPUT "${OUTPUT_NAME}"
COMMAND "csc.exe" "/output:$<SHELL_PATH:${OUTPUT_NAME}>" "MySource.cs"
)
```
This doesn't work. CMake emits this error message
```
add_custom_command called with OUTPUT containing a "<". This
character is not allowed
```
If I can't use generator expressions with ``OUTPUT``, how am I
supposed to output a file into the build directory of a target? It
doesn't look like reading the ``LIBRARY_OUTPUT_DIRECTORY`` property of
a target is really an option as according to the documentation that
itself may contain generator expressions.
Any thoughts would be appreciated.
Thanks,
Dan.
More information about the cmake-developers
mailing list