add_custom_command( OUTPUT "$<1:out.txt>" COMMAND ${CMAKE_COMMAND} -E touch "out.txt" VERBATIM ) add_custom_command( OUTPUT "out-$.txt" COMMAND ${CMAKE_COMMAND} -E touch "out-$.txt" VERBATIM ) add_custom_command( OUTPUT "out-$-$.txt" COMMAND ${CMAKE_COMMAND} -E touch "out-$-$.txt" VERBATIM ) add_custom_command( OUTPUT "out-$-$.txt" COMMAND ${CMAKE_COMMAND} -E touch "out-$-$.txt" VERBATIM ) add_custom_target(foo DEPENDS "out.txt" "out-$.txt" "out-$-$.txt" "out-$-$.txt")