Skip to content

Adds option COMMAND_EXPAND_LISTS to add_custom_command and add_custom_target

Ed Branch requested to merge brance/cmake:expand_custom_commands into master

This option allows lists generated by generator expressions passed as the COMMAND of add_custom_command and add_custom_target to be expanded.

This addresses the fact that the example in the [OUTPUT EXPRESIONS][1] section of the generator expression documentation gives the following example:

-I$<JOIN:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>, -I>

But this example cannot be made to work as expected when used as a custom COMMAND. This merge request allows it to work when modified as follows and when the new option is used:

"-I$<JOIN:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,;-I>"

or

-I$<JOIN:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,$<SEMICOLON>-I>

Related to #14353 (closed) implementing the functionality of the module attached to the original mantis issue much more cleanly with direct support in cmake. [1]: https://cmake.org/cmake/help/v3.7/manual/cmake-generator-expressions.7.html#output-expressions

Merge request reports