Files
CMake/Tests/RunCMake/add_custom_command/CommentGenex.cmake
Peter Würth 26d813092b add_custom_{command,target}: add genex support for COMMENT
Evaluate and expand generator expressions in the `COMMENT` argument of
the `add_custom_command()` and `add_custom_target()` commands.
This allows to include generator expressions, e.g. a targets location
$<TARGET_...> or the current configuration $<CONFIG>, in the build-time
messages.

Fixes #22507
2022-11-19 13:32:56 +01:00

10 lines
345 B
CMake

add_custom_target(helper)
set_property(TARGET helper PROPERTY MY_TEXT "lorem ipsum")
add_custom_command(
OUTPUT out.txt
COMMAND ${CMAKE_COMMAND} -E echo true
COMMENT "$<TARGET_PROPERTY:helper,MY_TEXT>$<COMMA> $<STREQUAL:foo,bar>$<EQUAL:42,42>"
)
set_property(SOURCE out.txt PROPERTY SYMBOLIC 1)
add_custom_target(main ALL DEPENDS out.txt)