Generator Expression in add_custom_command OUTPUT not working
Tried with version 3.20 on windows.
Code to reproduce:
# test 'add_custom_command(OUTPUT <...>)' generator expression
macro(add_custom_target_build
targetName
)
add_custom_command(
OUTPUT $<TARGET_PROPERTY:${targetName},property1>
COMMAND ${CMAKE_COMMAND}
ARGS -E touch $<TARGET_PROPERTY:${targetName},property1>
)
add_custom_target(build-${targetName}
DEPENDS $<TARGET_PROPERTY:${targetName},property1>
)
endmacro()
add_custom_target(target1)
set_target_properties(target1 PROPERTIES
property1 ${CMAKE_CURRENT_BINARY_DIR}/target1-property1-file.txt
)
add_custom_target_build(target1)
Error message:
Error evaluating generator expression:
$<TARGET_PROPERTY:target1,property1>
Target "target1" not found.
Edited by Andrii Gorin